CaseyCarter / cmcstl2

An implementation of C++ Extensions for Ranges
Other
223 stars 68 forks source link

Use iterator_concept rather than iterator_category #349

Open akrzemi1 opened 4 years ago

akrzemi1 commented 4 years ago

Iterator concepts in this library use iterator_traits<T>::iterator_category in the constraints, as in https://github.com/CaseyCarter/cmcstl2/blob/master/include/stl2/detail/iterator/concepts.hpp#L469

This is not conformant, as C++20 dictates that iterator_traits<T>::iterator_concept should be used whenever present (with a fallback to iterator_category when iterator_concept is absent); as in http://eel.is/c++draft/iterator.concept.forward#1

This is to allow defining iterators that have different category in C++17 than in C++20; like zip_iterator, which is an input iterator in C++17, but a random-access iterator in C++20 Ranges.