“stable_sort()ing” a STL <list> in C++
问题 I think the question title is clear enough: is is possible to stable_sort() a std::list in C++? Or do I have to convert it to a std::vector? I'm asking because I tried a simple example and it seems to require RandomAccessIterators, which a linked list doesn't have. So, how do I stable sort a std::list() ? EDIT: sample code that gives me an error: #include <list> #include <algorithm> // ... list<int> the_list; stable_sort(the_list.begin(), the_list.end()); g++ gives me around 30 lines of