简体   繁体   English

提高几何点设置器和吸气剂

[英]boost geometry point setter and getter

I'm working with the boost geometry library and i have read in the documentation that i should prefer using boost::geometry::set<0>(point1, 1.0); 我正在使用boost几何库,并且已经阅读了我更喜欢使用boost::geometry::set<0>(point1, 1.0);的文档boost::geometry::set<0>(point1, 1.0); instead of point1.set<0>(1.0); 代替point1.set<0>(1.0); Same with the get method: bg::get<0>(point1) instead of point1.get<0>(); 与get方法相同: bg::get<0>(point1) point1.get<0>(); bg::get<0>(point1)代替point1.get<0>();

Can anyone explain why i should do so? 谁能解释我为什么要这样做? The documentation is here (Examples; on the bottom of the page): boost point documentation 文档在此处(示例;在页面底部): 升压点文档

Using boost::geometry::get<0>(point1) you support any point type. 使用boost :: geometry :: get <0>(point1)支持任何点类型。 Also points having methods like point.x(). 还有具有诸如point.x()之类的方法的点。 Using point1.get<0>() you support only some point types, like the point type provided by Boost.Geometry. 使用point1.get <0>()您仅支持某些点类型,例如Boost.Geometry提供的点类型。 However, if that is all you need, you can use that of course too. 但是,如果仅此而已,您当然也可以使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM