Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] sort/unique functions

Subject: CGAL users discussion list

List archive

[cgal-discuss] sort/unique functions


Chronological Thread 
  • From:
  • To:
  • Subject: [cgal-discuss] sort/unique functions
  • Date: Tue, 18 May 2010 10:37:09 +0200 (MEST)
  • Importance: Normal

Sebastien Loriot (GeometryFactory) wrote:

wrote:
Hi,
I have no match calling the functions sort and unique for a list of 3D
points (I tried the comparison function K::Less_xyz_3 for sort). Could
you provide me any suggestion?
Thank you in advance!


Hello,
The sort algorithm requires random access iterators.
Try with a vector instead of a list.
std::vector<Point_3> vect;
std::sort(vect.begin(),vect.end());
S.
Andreas makes me notice that you may be talking about the sort/unique
member functions of std::list. In that case you can directly use the
function sort() and unique() as operator< are defined for points.

std::list<Point_3> lst;
lst.sort();
lst.unique();

S.

Hi and thank you for your prompt reply!
Your second suggestion was my first choice, but I obtain an increasing
sorted list for the x-coordinate and conversely decreasing lists for y and
z. Moreover the function unique remove only partially the identical
values.
I have just tried with the vector and this provides the same result.
C.
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss





Archive powered by MHonArc 2.6.16.

Top of Page