boostorg / polygon

Boost.org polygon module
http://boost.org/libs/polygon
57 stars 70 forks source link

voronoi_diagram provides no non-const acccessors to cells, edges and vertices #45

Closed bubnikv closed 4 years ago

bubnikv commented 4 years ago

voronoi_diagram provides const methods cells(), edges() and vertices(). Having no way to access non-const variants of these members makes impossible to set color of cells, edges or vertices without resorting to const_cast.

Please either provide non-const accessors.

I understand that it may not be a good idea to give non-const access to these voronoi_diagram elements. Alternatively, possibly a better solution would be to add set_color() methods to voronoi_diagram to possibly encapsulate the const_cast.

bubnikv commented 4 years ago

I see the color_ member on vertices, edges and cells are marked mutable, and the color setters are const, therefore it actually IS possible to set the color, therefore my complaint is not valid. I have never seen such an approach though, it is certainly surprising.