#include <vpsc/solve_VPSC.h>
#include <cstdlib>
#include <cassert>
+#include <vector>
#include <vpsc/csolve_VPSC.h>
Variable* newVariable(int id, double desiredPos, double weight) {
return new Variable(id,desiredPos,weight);
}
int genXConstraints(int n, boxf* bb, Variable** vs, Constraint*** cs,int transitiveClosure) {
-#ifdef _WIN32
- Rectangle** rs = new Rectangle* [n];
-#else
- Rectangle* rs[n];
-#endif
+ std::vector<Rectangle*> rs(n);
for(int i=0;i<n;i++) {
rs[i]=new Rectangle(bb[i].LL.x,bb[i].UR.x,bb[i].LL.y,bb[i].UR.y);
}
- int m = generateXConstraints(n,rs,vs,*cs,transitiveClosure?true:false);
+ int m = generateXConstraints(n,rs.data(),vs,*cs,transitiveClosure?true:false);
for(int i=0;i<n;i++) {
delete rs[i];
}
-#ifdef _WIN32
- delete [] rs;
-#endif
return m;
}
int genYConstraints(int n, boxf* bb, Variable** vs, Constraint*** cs) {
-#ifdef _WIN32
- Rectangle** rs = new Rectangle* [n];
-#else
- Rectangle* rs[n];
-#endif
+ std::vector<Rectangle*> rs(n);
for(int i=0;i<n;i++) {
rs[i]=new Rectangle(bb[i].LL.x,bb[i].UR.x,bb[i].LL.y,bb[i].UR.y);
}
- int m = generateYConstraints(n,rs,vs,*cs);
+ int m = generateYConstraints(n,rs.data(),vs,*cs);
for(int i=0;i<n;i++) {
delete rs[i];
}
-#ifdef _WIN32
- delete [] rs;
-#endif
return m;
}