Boost::Polygon - Polygon 90 Set Concept を使用して、大量の長方形を格納しています。残念ながら、完了後にメモリを割り当てることはできません。
これは最小限の例です。特定のポイントに設定されたポリゴンのメモリを割り当てたいと思います。clear() コマンドは、(ドキュメントに記載されているように) 割り当てを解除しません。
スコープを使い果たすことなく割り当てを解除する方法を知っている人はいますか?
#include <iostream>
#include <boost/polygon/polygon.hpp>
// Namespaces
using namespace std;
namespace bp = boost::polygon;
// Typedefs
typedef bp::rectangle_data<int> bpRect;
typedef bp::polygon_90_set_data<int> bpPolygonSet;
int main()
{
bpPolygonSet ps;
cout << "Filling" << endl;
for (int i=0; i<10000000; i++){
bpRect rect(i, i, i+1, i+1);
ps.insert(rect);
}
// clear() does not de allocate
ps.clear();
cout << "Cleared" << endl;
std::cin.get();
return 0;
}