The standard algorithm std::sort
requires random access iterators, which std::list<>::iterator
s are not (list iterators are bidirectional iterators).
You should use the std::list<>::sort
member function.
More Related Contents:
- c++ push reference node to stl list
- Sorting a vector of custom objects
- What’s the most efficient way to erase duplicates and sort a vector?
- C++ sorting and keeping track of indexes
- vector vs. list in STL
- How do I sort a std::vector by the values of a different std::vector?
- problem sorting using member function as comparator
- Is list::size() really O(n)?
- Sorting a vector in descending order
- how do you insert the value in a sorted vector?
- Does std::list::remove method call destructor of each removed element?
- c++ sort keeping track of indices [duplicate]
- How to use std::sort with a vector of structures and compare function?
- Sorting a std::vector by the string?
- array vs vector vs list
- Cleaning up an STL list/vector of pointers
- `std::list::sort()` – why the sudden switch to top-down strategy?
- Performance of qsort vs std::sort?
- How can I sort an STL map by value?
- Is std::pair ordering well-defined?
- Is there support in C++/STL for sorting objects by attribute?
- How to sort an STL vector?
- Which type of sorting is used in the std::sort()?
- list of polymorphic objects
- Why isn’t there an operator[] for a std::list?
- Is hash_map part of the STL?
- Why does storing references (not pointers) in containers in C++ not work?
- Can std::begin work with array parameters and if so, how?
- Is it more efficient to copy a vector by reserving and copying, or by creating and swapping? [duplicate]
- Obtain container type from (its) iterator type in C++ (STL)