take.cc
3.21 KB
-
libstdc++: Add missing friend declarations in some range adaptors · ba49e9eb
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.
Patrick Palka committed