I have an Arrangement_2
class, instantiated with a custom Arr_face_extended_dcel
to map some data to each cell.
I'd like to find some cells with a locate
invocation and change their associated data, but unfortunately locate
returns an iterator to some Face_const_handle
s, so I can't invoke set_data(...)
because that would break the const
ness.
So, my question: is there a way to efficiently change the data mapped to a face found with a locate
without resorting to nasty const_cast
s?
You have to use the overloaded member template functions
non_const_handle()
of theArrangement_2
template class. There are 3 versions, which acceptVertex_const_handle
,Halfedge_const_handle
, andFace_const_handle
, respectively; see the manual.BW,
const_cast<>
will not work. because, for example,Vertex_const_handle
andVertex_handle
are simply different types.