libstdc++: Define C++20 range utilities and range factories
authorJonathan Wakely <jwakely@redhat.com>
Sun, 17 Nov 2019 01:07:54 +0000 (01:07 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Sun, 17 Nov 2019 01:07:54 +0000 (01:07 +0000)
commit37f33df706851a00b2f5c0d429f6b273e8ab0029
tree89d2a3044496f079abefbef51db26f0773923781
parentefbd2539e1ff2a6155cd5c685aab165fdc760ab0
libstdc++: Define C++20 range utilities and range factories

This adds another chunk of the <ranges> header.

The changes from P1456R1 (Move-only views) and P1862R1 (Range adaptors
for non-copyable iterators) are included, but not the changes from
P1870R1 (forwarding-range<T> is too subtle).

The tests for subrange and iota_view are poor and should be improved.

* include/bits/regex.h (match_results): Specialize __enable_view_impl.
* include/bits/stl_set.h (set): Likewise.
* include/bits/unordered_set.h (unordered_set, unordered_multiset):
Likewise.
* include/debug/multiset.h (__debug::multiset): Likewise.
* include/debug/set.h (__debug::set): Likewise.
* include/debug/unordered_set (__debug::unordered_set)
(__debug::unordered_multiset): Likewise.
* include/std/ranges (ranges::view, ranges::enable_view)
(ranges::view_interface, ranges::subrange, ranges::empty_view)
(ranges::single_view, ranges::views::single, ranges::iota_view)
(ranges::views::iota): Define for C++20.
* testsuite/std/ranges/empty_view.cc: New test.
* testsuite/std/ranges/iota_view.cc: New test.
* testsuite/std/ranges/single_view.cc: New test.
* testsuite/std/ranges/view.cc: New test.

From-SVN: r278370
13 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/regex.h
libstdc++-v3/include/bits/stl_multiset.h
libstdc++-v3/include/bits/stl_set.h
libstdc++-v3/include/bits/unordered_set.h
libstdc++-v3/include/debug/multiset.h
libstdc++-v3/include/debug/set.h
libstdc++-v3/include/debug/unordered_set
libstdc++-v3/include/std/ranges
libstdc++-v3/testsuite/std/ranges/empty_view.cc [new file with mode: 0644]
libstdc++-v3/testsuite/std/ranges/iota_view.cc [new file with mode: 0644]
libstdc++-v3/testsuite/std/ranges/single_view.cc [new file with mode: 0644]
libstdc++-v3/testsuite/std/ranges/view.cc [new file with mode: 0644]