libstdc++: Implement P1739R4 changes to views::take/drop/counted
authorPatrick Palka <ppalka@redhat.com>
Thu, 21 Oct 2021 15:55:16 +0000 (11:55 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 21 Oct 2021 15:55:16 +0000 (11:55 -0400)
commit9626e44713ac4bd3c8a04ae7e62a77fae7b771e0
tree984fa4eaa04c555919d77d24eb8e9378386c4e45
parentbdc42283bc7147bc01557dfab6a8c96bf31cf25a
libstdc++: Implement P1739R4 changes to views::take/drop/counted

This implements P1739R4 along with the resolution for LWG 3407 which
corrects the paper's wording.

libstdc++-v3/ChangeLog:

* include/bits/ranges_util.h (views::_Drop): Forward declare.
(subrange): Befriend views::_Drop.
(subrange::_S_store_size): Declare constexpr instead of just
const, remove obsolete comment.
* include/std/ranges (views::__detail::__is_empty_view): Define.
(views::__detail::__is_basic_string_view): Likewise.
(views::__detail::__is_subrange): Likewise.
(views::__detail::__is_iota_view): Likewise.
(views::__detail::__can_take_view): Rename template parm _Tp to _Dp.
(views::_Take): Rename template parm _Tp to _Dp, make it non-deducible
and fix it to range_difference_t<_Range>.  Implement P1739R4 and
LWG 3407 changes.
(views::__detail::__can_drop_view): Rename template parm _Tp to _Dp.
(views::_Drop): As with views::_Take.
(views::_Counted): Implement P1739R4 changes.
* include/std/span (__detail::__is_std_span): Rename to ...
(__detail::__is_span): ... this and turn it into a variable
template.
(__detail::__is_std_array): Turn it into a variable template.
(span::span): Adjust uses of __is_std_span and __is_std_array
accordingly.
* testsuite/std/ranges/adaptors/p1739.cc: New test.
libstdc++-v3/include/bits/ranges_util.h
libstdc++-v3/include/std/ranges
libstdc++-v3/include/std/span
libstdc++-v3/testsuite/std/ranges/adaptors/p1739.cc [new file with mode: 0644]