This should be pretty simple. I can't for the life of me find the answer on google or remember to look through my books at home. Figure I'll just ask here and see what happens. I have a vector or ints or unsigned ints vector<unsigned int> vec vec.push_back(1); vec.push_back(1); vec.push_back(1); And I want to sort it Descending. When I call std::sort(vec.begin(), vec.end()); it sorts ascending. What would I add for the third parameter to get it to sort descending instead? B-)
sheeesh! finally found it std::sort(vec.begin(), vec.end(), greater<unsigned int>()); as apposed to std::sort(vec.begin(), vec.end(), less<unsigned int>()); B-) On Wednesday 23 February 2005 08:21 am, Brad Bourn wrote:
This should be pretty simple. I can't for the life of me find the answer on google or remember to look through my books at home.
Figure I'll just ask here and see what happens.
I have a vector or ints or unsigned ints
vector<unsigned int> vec
vec.push_back(1); vec.push_back(1); vec.push_back(1);
And I want to sort it Descending.
When I call
std::sort(vec.begin(), vec.end());
it sorts ascending.
What would I add for the third parameter to get it to sort descending instead?
B-)
participants (1)
-
Brad Bourn