]> gcc.gnu.org Git - gcc.git/commit - libstdc++-v3/ChangeLog
libstdc++: Implement C++20 changes to insert iterators
authorJonathan Wakely <jwakely@redhat.com>
Fri, 27 Mar 2020 23:21:58 +0000 (23:21 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 27 Mar 2020 23:26:01 +0000 (23:26 +0000)
commitae6076b5bc1e0b689eaa8521571b0516de336553
treeb1f1845ab2180e4873036bb6d89ba93481a76d48
parent0302a2de7f143bc4ac2a963761abc684b4dd6ddb
libstdc++: Implement C++20 changes to insert iterators

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.
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/iterator_concepts.h
libstdc++-v3/include/bits/range_access.h
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/testsuite/24_iterators/back_insert_iterator/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/24_iterators/front_insert_iterator/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis_c++17.cc
libstdc++-v3/testsuite/24_iterators/insert_iterator/constexpr.cc [new file with mode: 0644]
This page took 0.065495 seconds and 5 git commands to generate.