ID field intermittently lost in custom point class

后端 未结 2 2107
予麋鹿
予麋鹿 2020-12-07 00:14

I\'m building a C++ program which needs to handle geometry. I have been trying to get boost::geometry to work, but I am having the following issue. My points ne

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 00:23

    You carry out a BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET. The thing is, this tells the library how to set the x and y values. It never tells the library how to set an ID value (or that it is even there).

    So, the library will simply construct an identical point, logically, by using the setters for x and y, and of course, you'll be stuck with no id.

提交回复
热议问题