Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] HalfedgeDS_*::Vertex_handle in std::set and std::map?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] HalfedgeDS_*::Vertex_handle in std::set and std::map?


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] HalfedgeDS_*::Vertex_handle in std::set and std::map?
  • Date: Fri, 28 Sep 2007 11:54:44 +0200

Bart Janssens wrote:
On 9/28/07, Tom Bobach
<>
wrote:
Dear CGAL community,

I am facing the problem that in the default halfedge data structure
implementation there is no comparison operator defined for handles and
iterators.
This makes usage of Handles in std::set and std::map unnecessarily
complicated. I am wondering if someone else faced this problem and if there
is an easy, non-intrusive way to fix this.

I got around the problem using probably the least elegant, but easiest
solution: I dereferenced the handle, and then stored the address of
the resulting object in an std::map, i.e. map[&(*handle)] = blah;

regards,


Hello,

You can define

bool operator< ( const Handle& x, const Handle& y )
{
return &*x < &*y ;
}


As the std::map takes std::less as default comparason functor
and this one applies operator< this solves all these problems.


andreas



Archive powered by MHonArc 2.6.16.

Top of Page