Subject: CGAL users discussion list
List archive
- From: Matthijs Sypkens Smit <>
- To:
- Subject: Re: [cgal-discuss] defining operator< for CGAL handles
- Date: Fri, 9 Nov 2007 07:51:14 +0100
On Wednesday 10 October 2007 16:52, Andreas Fabri wrote:
> Hi Bernhard
>
> Define
>
> operator<(const PFacet_handle& f1, const PFacet_handle& f2)
> {
> return &*f1 < &*f2;
> }
>
> This should work as std::set has less<T> as default comparator
> which just calls operator<
For those that actually search mailing list archives, I would like to add:
If you do not import the complete CGAL namespace, then you need to place
this operator in the CGAL namespace, thus:
namespace CGAL
{
bool operator<( const PVertex_handle &h1, const PVertex_handle &h2)
{
return &*h1 < &*h2;
}
}
It took me quite a bit of searching and experimenting, before I found this
solution. Apparently, types defined in a certain namespace, need to have
their operator in the same namespace.
--
Matthijs Sypkens Smit
- Re: [cgal-discuss] defining operator< for CGAL handles, Matthijs Sypkens Smit, 11/09/2007
- Re: [cgal-discuss] defining operator< for CGAL handles, Ophir Setter, 11/09/2007
Archive powered by MHonArc 2.6.16.