libstdc++: Add missing friend declarations in some range adaptors
authorPatrick Palka <ppalka@redhat.com>
Wed, 26 Feb 2020 17:31:01 +0000 (12:31 -0500)
committerPatrick Palka <ppalka@redhat.com>
Thu, 27 Feb 2020 17:47:17 +0000 (12:47 -0500)
commitba49e9eb18730cc71e5ffc302092f87ef6821f24
treeee475a61860977eda886a2ecd3e52d191986f9b1
parent10a32d479861c3a39987d3468f6a400e907499a2
libstdc++: Add missing friend declarations in some range adaptors

Some of the range adaptors have distinct constant and non-constant
iterator/sentinel types, along with converting constructors that can convert a
non-constant iterator/sentinel to a constant iterator/sentinel.  This patch adds
the missing appropriate friend declarations in order to make these converting
constructors well formed.

Strictly speaking it seems the friendship relations don't need to go both ways
-- we could get away with declaring e.g. friend _Iterator<false>; instead of
friend _Iterator<!_Const>; but both reference implementations seem to use the
latter symmetric form anyway.

libstdc++-v3/ChangeLog:

* include/std/ranges (transform_view::_Iterator<_Const>): Befriend
_Iterator<!_Const>.
(transform_view::_Sentinel<_Const>): Befriend _Sentinel<!_Const>.
(take_view::_Sentinel<_Const>): Likewise.
(take_while_view::_Sentinel<_Const>): Likewise.
(split_view::_OuterIter<_Const>): Befriend _OuterIter<!_Const>.
* testsuite/std/ranges/adaptors/split.cc: Augment test.
* testsuite/std/ranges/adaptors/take.cc: Augment test.
* testsuite/std/ranges/adaptors/take_while.cc: Augment test.
* testsuite/std/ranges/adaptors/transform.cc: Augment test.
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/ranges
libstdc++-v3/testsuite/std/ranges/adaptors/split.cc
libstdc++-v3/testsuite/std/ranges/adaptors/take.cc
libstdc++-v3/testsuite/std/ranges/adaptors/take_while.cc
libstdc++-v3/testsuite/std/ranges/adaptors/transform.cc