libstdc++: Implement P2017R1 "Conditionally borrowed ranges"
authorJonathan Wakely <jwakely@redhat.com>
Fri, 30 Oct 2020 18:39:43 +0000 (18:39 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 30 Oct 2020 23:25:52 +0000 (23:25 +0000)
commit39bf4f14fc75e14aafc4ba8a53a34775f29b743a
treebf5aeb9ac24f784abe3f2e5b63e0ded66f0a1f03
parentf03851e1a6dac72127e97629e259ad01a2b1e7b6
libstdc++: Implement P2017R1 "Conditionally borrowed ranges"

This makes some range adaptors model the borrowed_range concept if they
are adapting a borrowed range. This hasn't been added to the C++23
working paper yet, but it has been approved by LWG, and the
recommendation is to treat it as a defect report for C++20 as well.

libstdc++-v3/ChangeLog:

* include/std/ranges (enable_borrowed_view<take_view<T>>)
(enable_borrowed_view<drop_view<T>>)
(enable_borrowed_view<drop_while_view<T>>)
(enable_borrowed_view<reverse_view<T>>)
(enable_borrowed_view<common_view<T>>)
(enable_borrowed_view<elements_view<T>>): Add partial
specializations as per P2017R1.
* testsuite/std/ranges/adaptors/conditionally_borrowed.cc:
New test.
libstdc++-v3/include/std/ranges
libstdc++-v3/testsuite/std/ranges/adaptors/conditionally_borrowed.cc [new file with mode: 0644]