Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Map with Polyhedron::Vertex_handle

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Map with Polyhedron::Vertex_handle


Chronological Thread 
  • From: Camille Wormser <>
  • To: <>
  • Subject: Re: [cgal-discuss] Map with Polyhedron::Vertex_handle
  • Date: Thu, 10 Sep 2009 12:56:00 +0200

Error 17 error C2678: binary '<' : no operator found which takes a
left-hand operand of type 'const Vertex_handle' (or there is no acceptable
conversion) C:\Program Files\Microsoft Visual Studio
8\VC\include\functional 143

Please could you give us an example or a link to an example using map []
properly on Polyhedron::Vertex_handle?

Hello,
The std::map needs a comparison operator for the keys, i.e., the Vertex_handles, which do not provide such an operator. You could add a comparison class in the following way:

/* compares the corresponding pointers */
template < class Handle >
struct Handle_comparison
{
bool operator() (const Handle& h1, const Handle& h2) const
{
return &(*h1) < &(*h2);
}
};

and then define the std::map as

std::map < Polyhedron::Vertex_handle, int,
Handle_comparison<Polyhedron::Vertex_handle> > listVertex;

--
Camille




Archive powered by MHonArc 2.6.16.

Top of Page