cgal + 点数组

cgal + array of points

我知道在 CGAL 中我们可以通过以下方式访问 Point_2 的元素:

typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;
Point_2 points(1.0,1.0);

int main(){
std::cout<<points.x()<<"\t"<<points.y();
return 0;}

但是我怎样才能对一组点执行此操作:

typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;
typedef std::vector<Point_2> Vector;

Vector points;
points.reserve(N);

int main(){
points[0].x() =1;
points[0].y() =1;
return 0;}

points[i].x() 或 points[i].x 产生错误。

正如评论中提到的朋友,你可以这样做:

    int main(){

        points.push_back(Point_2(1.0,1.0));
        return 0;

    }