-
Couldn't load subscription status.
- Fork 61
Description
In one of his blog posts, Eric Nieber introduces generic counted iterators, which might come along with the Ranges TS. These iterators allow to use the same algorithms for usual iterables and counted iterables instead of having to provide counted versions of the algorithms (e.g. copy_n and friends). The proposed mechanism relies on sentinel parameters, so this issue logically comes after issue #20, and would also need a small update on the standard library side in order to work properly, making it a future issue.
Anyway, we should take into account the fact that counting iterables will be proposed for standardization at some point, and think of how it might impact cpp-sort. It shouldn't make things really different, and even things like counted and uncounted should not be a problem since we don't have counted algorithms in the library.
A new problem arises: in the new iterations of the work related to the Ranges TS, std::sort is specified to return the end iterator. This is because when passed a normal iterator and a counted sentinel, the actual end iterator of the algorithm is unknown even though it is valuable information that is most probably computed by the sorting algorithm. The first obvious problem is that we will probably have to add that to every sorting algorithm of the library.
The second and most subtle problem has to do with adapters: today counting_adapter returns an integer type. When given a sorter that returns an iterator, should it return the integer type instead, or build a tuple with the integer type and the iterator type? I have currently no elegant solution to this problem.
Metadata
Metadata
Assignees
Labels
Projects
Status