-
libstdc++: Implement C++20 changes to insert iterators · ae6076b5
std::insert_iterator and std::inserter need to be adjusted for C++20, so that they use ranges::iterator_t. That alias template requires ranges::begin to be defined. Rather than moving the whole of ranges::begin (and related details like ranges::enable_borrowed_range) into <iterator>, this defines a new, simpler version of ranges::begin that is sufficient for ranges::iterator_t to be defined. This works because ranges::iterator_t uses an lvalue reference type, so the logic in ranges::begin for non-lvalue ranges (i.e. borrowed ranges) isn't needed. This also adds the missing constexpr specifiers to the other insert iterators. * include/bits/iterator_concepts.h (__detail::__decay_copy) (__detail::__member_begin, __detail::__adl_begin): Move here from <bits/range_access.h>. (__detail::__ranges_begin, __detail::__range_iter_t): Define. * bits/range_access.h (__cust_access::__decay_copy) (__cust_access::__member_begin, __cust_access::__adl_begin): Move to <bits/iterator_concepts.h>. (ranges::iterator_t): Use __detail::__range_iter_t. * include/bits/stl_iterator.h (back_insert_iterator): Simplify conditional compilation. Add _GLIBCXX20_CONSTEXPR to all members. (front_insert_iterator): Likewise. (insert_iterator): Implement changes from P0896R4 for C++20. * testsuite/24_iterators/back_insert_iterator/constexpr.cc: New test. * testsuite/24_iterators/front_insert_iterator/constexpr.cc: New test. * testsuite/24_iterators/headers/iterator/synopsis_c++17.cc: Adjust for inclusion in synopsis_c++20.cc which expects different signatures for some function templates. * testsuite/24_iterators/insert_iterator/constexpr.cc: New test.
Jonathan Wakely committed
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
range_access_c++11.cc | Loading commit data... | |
range_access_c++14.cc | Loading commit data... | |
range_access_c++17.cc | Loading commit data... | |
synopsis.cc | Loading commit data... | |
synopsis_c++11.cc | Loading commit data... | |
synopsis_c++14.cc | Loading commit data... | |
synopsis_c++17.cc | Loading commit data... | |
synopsis_c++20.cc | Loading commit data... | |
types_std.cc | Loading commit data... |