sorting a std::list

velthuijsen_at_hotmail.com
Date: 12/31/04


Date: 31 Dec 2004 01:15:47 -0800

I tried taking a list and pass it through std::sort like the following:
sort(Unsorted.begin(), Unsorted.end());
I got an error back stating that the list iterator doesn't have a
binary substraction operator.
Peeking in the algoritm header file it's clear why seeing that sort
there calls _sort(_First, _Last, _Last-_First) which might be a tad
challenging seeing that the different values stored in a list do not
need to be stored consecutively.
My question is there another way to sort the list in the STL?



Relevant Pages

  • Re: sorting a std::list
    ... > binary substraction operator. ... > Peeking in the algoritm header file it's clear why seeing that sort ... > challenging seeing that the different values stored in a list do not ... > My question is there another way to sort the list in the STL? ...
    (comp.lang.cpp)
  • Re[2]: [Full-Disclosure] Gentoo-announce flood
    ... Hash: SHA1 ... Kl> I am certainly not mocking anyone... ... Kl> simply stating that this sort of thing has happened before with other ...
    (Full-Disclosure)
  • Re: sorting a std::list
    ... >> binary substraction operator. ... >> Peeking in the algoritm header file it's clear why seeing that sort ... >> challenging seeing that the different values stored in a list do not ... >> My question is there another way to sort the list in the STL? ...
    (comp.lang.cpp)
  • Re: sorting a std::list
    ... > binary substraction operator. ... > Peeking in the algoritm header file it's clear why seeing that sort ... > challenging seeing that the different values stored in a list do not ... > My question is there another way to sort the list in the STL? ...
    (comp.lang.cpp)
  • Re: How the 17th Amendment has Stolen Your Freedom
    ... an advocate of this sort of thing, just stating an opinion. ...
    (misc.news.internet.discuss)