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

, std:: sort. : Sortable std:: list?

, , . , , , , , Sortable -access-iterator — std::sort, , ; , std::list, .

, , , FlexySortable ( flexy_sort), , . a, , , , (.. ).

+5

std::list . , : n th O (n) ( , .. O (1)).

std::vector ; n th . , .

.

+3

Sortable ; . , ?

, Ranges TS, , , ++ 2a, Sortable concept. , , - Permutable, ForwardIterator s.

+2

All Articles