[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sorting vectors
From: |
Joe Neeman |
Subject: |
Sorting vectors |
Date: |
Fri, 7 Apr 2006 18:16:07 +1100 |
User-agent: |
KMail/1.8.3 |
flower/include/std-vector.hh contains the comment:
/* FIXME: the COMPARE functionality is broken? */
and the version of vector_sort that makes use of the STL sort algorithm is
commented out. But based on my reading of the SGI STL manual[1], you are just
using the wrong compare function. You use a compare function like
int compare_int (const int &a, const int &b) {return sign (a - b);}
but it expects
bool compare_int (const int &a, const int &b) {return a < b;}
(which is what the STL function less<T> does (if the class that you are
comparing has a "<" operator))
Joe
[1] http://www.sgi.com/tech/stl/table_of_contents.html
- Sorting vectors,
Joe Neeman <=