Why is std :: list <int> not sorting?
I am just reading a (printed, German) article on C ++ concepts (C ++ 20).
The article provides an example of a function template using the concept Sortable:
template<typename Cont>
requires Sortable<Cont>()
void sort(Cont& container) { ... }
And he claims that the compiler rejected the following code:
std::list<int> lst = { 1, 7, 5, 12 };
sort(lst);
with an error like:
ERROR: lst is not a random access container with <
Assuming the article is correct: why is the list from int not sorted? For me, a list of integers is like a canonical example, when we think of something "sortable" ?!
And no, I'm not asking about std :: sort . I ask: why does the concept of Sortable not work for std::list<int>?
+6
3