libstdc++: Introduce new headers for C++20 ranges components
authorJonathan Wakely <jwakely@redhat.com>
Tue, 22 Sep 2020 14:45:54 +0000 (15:45 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 22 Sep 2020 14:45:54 +0000 (15:45 +0100)
commit160061ac10f9143d9698daac5f7e46b5a615825c
tree1374ca7bb120f47da781098591af719e76019d44
parent7df1534c136e2556ca10d3a60d2b2cc77544dbc8
libstdc++: Introduce new headers for C++20 ranges components

This introduces two new headers:

<bits/ranges_base.h> defines the minimal components needed
for using C++20 ranges (customization point objects such as
std::ranges::begin, concepts such as std::ranges::range, etc.)

<bits/ranges_util.h> includes <bits/ranges_base.h> and additionally
defines subrange, which is needed by <bits/ranges_algo.h>.

Most of the content of <bits/ranges_base.h> was previously defined in
<bits/range_access.h>, but a few pieces were only defined in <ranges>.
This meant the entire <ranges> header was needed in <algorithm> and
<memory>, even though they don't use all the range adaptors.

By moving the ranges components out of <bits/range_access.h> that file
is left defining just the contents of [iterator.range] i.e. std::begin,
std::end, std::size etc. and not C++20 ranges components.

For consistency with other C++20 ranges headers, <bits/range_cmp.h> is
renamed to <bits/ranges_cmp.h>.

libstdc++-v3/ChangeLog:

* include/Makefile.am: Add new headers and adjust for renamed
header.
* include/Makefile.in: Regenerate.
* include/bits/iterator_concepts.h: Adjust for renamed header.
* include/bits/range_access.h (ranges::*): Move to new
<bits/ranges_base.h> header.
* include/bits/ranges_algobase.h: Include new <bits/ranges_base.h>
header instead of <ranges>.
* include/bits/ranges_algo.h: Include new <bits/ranges_util.h>
header.
* include/bits/range_cmp.h: Moved to...
* include/bits/ranges_cmp.h: ...here.
* include/bits/ranges_base.h: New header.
* include/bits/ranges_util.h: New header.
* include/experimental/string_view: Include new
<bits/ranges_base.h> header.
* include/std/functional: Adjust for renamed header.
* include/std/ranges (ranges::view_base, ranges::enable_view)
(ranges::dangling, ranges::borrowed_iterator_t): Move to new
<bits/ranges_base.h> header.
(ranges::view_interface, ranges::subrange)
(ranges::borrowed_subrange_t): Move to new <bits/ranges_util.h>
header.
* include/std/span: Include new <bits/ranges_base.h> header.
* include/std/string_view: Likewise.
* testsuite/24_iterators/back_insert_iterator/pr93884.cc: Add
missing <ranges> header.
* testsuite/24_iterators/front_insert_iterator/pr93884.cc:
Likewise.
17 files changed:
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/bits/iterator_concepts.h
libstdc++-v3/include/bits/range_access.h
libstdc++-v3/include/bits/range_cmp.h [deleted file]
libstdc++-v3/include/bits/ranges_algo.h
libstdc++-v3/include/bits/ranges_algobase.h
libstdc++-v3/include/bits/ranges_base.h [new file with mode: 0644]
libstdc++-v3/include/bits/ranges_cmp.h [new file with mode: 0644]
libstdc++-v3/include/bits/ranges_util.h [new file with mode: 0644]
libstdc++-v3/include/experimental/string_view
libstdc++-v3/include/std/functional
libstdc++-v3/include/std/ranges
libstdc++-v3/include/std/span
libstdc++-v3/include/std/string_view
libstdc++-v3/testsuite/24_iterators/back_insert_iterator/pr93884.cc
libstdc++-v3/testsuite/24_iterators/front_insert_iterator/pr93884.cc