libstdc++/ranges: Use C++23 deducing this in _Pipe and _Partial
This simplifies the operator() of the _Pipe and _Partial range adaptor closure objects using C++23 deducing this, allowing us to condense multiple operator() overloads into one. The new __like_t alias template is similar to the expositional one from P0847R6 except it's implemented in terms of forward_like instead of vice versa, and thus ours always yields a reference so e.g. __like_t<A, char> is char&& instead of char. For our purposes (forwarding) this shouldn't make a difference, I think.. libstdc++-v3/ChangeLog: * include/bits/move.h (__like_t): Define in C++23 mode. * include/std/ranges (views::__adaptor::Partial::operator()): Implement using C++23 deducing this when available. (views::__adaptor::_Pipe::operator()): Likewise. * testsuite/std/ranges/adaptors/100577.cc: Adjust testcase to accept new "no match for call" errors issued in C++23 mode. * testsuite/std/ranges/adaptors/lazy_split_neg.cc: Likewise.
Showing
- libstdc++-v3/include/bits/move.h 3 additions, 0 deletionslibstdc++-v3/include/bits/move.h
- libstdc++-v3/include/std/ranges 34 additions, 2 deletionslibstdc++-v3/include/std/ranges
- libstdc++-v3/testsuite/std/ranges/adaptors/100577.cc 9 additions, 9 deletionslibstdc++-v3/testsuite/std/ranges/adaptors/100577.cc
- libstdc++-v3/testsuite/std/ranges/adaptors/lazy_split_neg.cc 1 addition, 1 deletionlibstdc++-v3/testsuite/std/ranges/adaptors/lazy_split_neg.cc
Loading
Please register or sign in to comment