Bit byte wrote:
> I just came accross this : "Note that the STL sort algorithm does NOT
> work for lists; that's why a sort member function is supplied."
>
> Is this true?
Yes. std::sort requires random-access iterators, which std::list does
not supply.
> Has this been fixed in newer versions of the STL?
There's nothing to fix. If you need to sort a list, you can use
std::list's member function std::list::sort, which will do the job.
That's been the case since the C++ standard was adopted in 1998, and it
hasn't changed.
Best regards,
Tom
|