我有一个Arrangement_2
类,使用自定义Arr_face_extended_dcel
进行实例化,以将一些数据映射到每个单元格。
我希望找到一些locate
调用的单元格并更改其关联数据,但不幸的是locate
会返回一些Face_const_handle
的迭代器,所以我可以&# 39; t调用set_data(...)
,因为这会破坏const
。
所以,我的问题是:有没有办法有效地更改映射到使用locate
找到的面部的数据而不诉诸讨厌的const_cast
?
答案 0 :(得分:1)
您必须使用non_const_handle()
模板类的重载成员模板函数Arrangement_2
。有3个版本,分别接受Vertex_const_handle
,Halfedge_const_handle
和Face_const_handle
;见manual。
BW,const_cast<>
无效。例如,Vertex_const_handle
和Vertex_handle
只是不同的类型。