简体   繁体   中英

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); instead of point1.set<0>(1.0); Same with the get method: bg::get<0>(point1) instead of 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. Also points having methods like point.x(). Using point1.get<0>() you support only some point types, like the point type provided by Boost.Geometry. However, if that is all you need, you can use that of course too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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