我写了一个使用CGAL的简单测试程序,但遇到了以下问题:
点被定义为上方所示。
typedef K::Point_d Point;
但我认为这并不相关。
当我尝试按以下方式编译程序时:
const int size = 10;
Point P[size];
毫无问题地执行此操作。如果我试图编译其他内容:
const int size = stoi("10");
Point P[size]
我遇到了以下错误。
error: variable length array of non-POD element type 'Point' (aka 'Point_d<Cartesian_d<double,
CGAL::Linear_algebraCd<double, std::__1::allocator<double> > > >')
为什么从字符串中检索大小时,大小被视为变量而不是常量?
stoi
没有被标记为constexpr
,而且它处理的是std::string
,这可能不符合要求,因为std::string
执行了许多在constexpr
函数中不允许的操作(例如内存分配)。 - Matteo Italia