gcc/libstdc++-v3/include/std
Patrick Palka 0f4a2fb44d libstdc++: Refine range adaptors' "simple extra args" mechanism [PR100940]
The _S_has_simple_extra_args mechanism is used to simplify forwarding
of range adaptor's extra arguments when perfect forwarding call wrapper
semantics isn't required for correctness, on a per-adaptor basis.
Both views::take and views::drop are flagged as such, but it turns out
perfect forwarding semantics are needed for these adaptors in some
contrived cases, e.g. when their extra argument is a move-only class
that's implicitly convertible to an integral type.

To fix this, we could just clear the flag for views::take/drop as with
views::split, but that'd come at the cost of acceptable diagnostics
for ill-formed uses of these adaptors (see PR100577).

This patch instead allows adaptors to parameterize their
_S_has_simple_extra_args flag according the types of the captured extra
arguments, so that we could conditionally disable perfect forwarding
semantics only when the types of the extra arguments permit it.  We
then use this finer-grained mechanism to safely disable perfect
forwarding semantics for views::take/drop when the extra argument is
integer-like, rather than incorrectly always disabling it.  Similarly,
for views::split, rather than always enabling perfect forwarding
semantics we now safely disable it when the extra argument is a scalar
or a view, and recover good diagnostics for these common cases.

	PR libstdc++/100940

libstdc++-v3/ChangeLog:

	* include/std/ranges (__adaptor::_RangeAdaptor): Document the
	template form of _S_has_simple_extra_args.
	(__adaptor::__adaptor_has_simple_extra_args): Add _Args template
	parameter pack.  Try to treat _S_has_simple_extra_args as a
	variable template parameterized by _Args.
	(__adaptor::_Partial): Pass _Arg/_Args to the constraint
	__adaptor_has_simple_extra_args.
	(views::_Take::_S_has_simple_extra_args): Templatize according
	to the type of the extra argument.
	(views::_Drop::_S_has_simple_extra_args): Likewise.
	(views::_Split::_S_has_simple_extra_args): Define.
	* testsuite/std/ranges/adaptors/100577.cc (test01, test02):
	Adjust after changes to _S_has_simple_extra_args mechanism.
	(test03): Define.
2021-06-17 09:46:04 -04:00
..
algorithm Update copyright years. 2021-01-04 10:26:59 +01:00
any libstdc++: Fix std::any constraints [PR101034] 2021-06-14 15:10:56 +01:00
array Update copyright years. 2021-01-04 10:26:59 +01:00
atomic libstdc++: Refactor/cleanup of C++20 atomic wait implementation 2021-04-20 15:14:58 +01:00
barrier [libstdc++] Remove unused hasher instance. 2021-06-08 15:41:31 -07:00
bit libstdc++: Fix <bit> to work freestanding [PR 100060] 2021-04-13 17:54:03 +01:00
bitset libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
charconv libstdc++: Disable floating_to_chars.cc on 16 bit targets 2021-05-20 13:21:41 +01:00
chrono libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
codecvt Update copyright years. 2021-01-04 10:26:59 +01:00
complex libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
concepts Update copyright years. 2021-01-04 10:26:59 +01:00
condition_variable libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
coroutine libstdc++: Make coroutine_handle<_Promise>::from_address() noexcept [PR 99021] 2021-02-09 12:31:52 +00:00
deque Update copyright years. 2021-01-04 10:26:59 +01:00
execution Update copyright years. 2021-01-04 10:26:59 +01:00
filesystem Update copyright years. 2021-01-04 10:26:59 +01:00
forward_list Update copyright years. 2021-01-04 10:26:59 +01:00
fstream libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
functional Update copyright years. 2021-01-04 10:26:59 +01:00
future libstdc++: Fix null dereferences in std::promise 2021-05-04 22:46:24 +01:00
iomanip Update copyright years. 2021-01-04 10:26:59 +01:00
ios Update copyright years. 2021-01-04 10:26:59 +01:00
iosfwd Update copyright years. 2021-01-04 10:26:59 +01:00
iostream libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
istream libstdc++: Fix constraints for rvalue stream insertion/extraction 2021-05-07 23:45:52 +01:00
iterator Update copyright years. 2021-01-04 10:26:59 +01:00
latch libstdc++: Fix whitespace in license boilerplate 2021-04-21 12:59:58 +01:00
limits Update copyright years. 2021-01-04 10:26:59 +01:00
list Update copyright years. 2021-01-04 10:26:59 +01:00
locale Update copyright years. 2021-01-04 10:26:59 +01:00
map Update copyright years. 2021-01-04 10:26:59 +01:00
memory libstdc++: Fix even more doxygen markup for group close commands 2021-04-09 13:09:23 +01:00
memory_resource libstdc++: Add warnings for some C++23 deprecations 2021-06-09 10:32:43 +01:00
mutex libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
numbers Update copyright years. 2021-01-04 10:26:59 +01:00
numeric libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
optional libstdc++: Fix constraint on std::optional assignment [PR 100982] 2021-06-09 12:45:11 +01:00
ostream libstdc++: Fix constraints for rvalue stream insertion/extraction 2021-05-07 23:45:52 +01:00
queue Update copyright years. 2021-01-04 10:26:59 +01:00
random Update copyright years. 2021-01-04 10:26:59 +01:00
ranges libstdc++: Refine range adaptors' "simple extra args" mechanism [PR100940] 2021-06-17 09:46:04 -04:00
ratio libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
regex Update copyright years. 2021-01-04 10:26:59 +01:00
scoped_allocator Update copyright years. 2021-01-04 10:26:59 +01:00
semaphore libstdc++: Remove #error from <semaphore> implementation [PR 100179] 2021-04-22 13:59:32 +01:00
set Update copyright years. 2021-01-04 10:26:59 +01:00
shared_mutex libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
source_location Update copyright years. 2021-01-04 10:26:59 +01:00
span Update copyright years. 2021-01-04 10:26:59 +01:00
sstream Update copyright years. 2021-01-04 10:26:59 +01:00
stack Update copyright years. 2021-01-04 10:26:59 +01:00
stdexcept libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
stop_token libstdc++: Remove TODO comment 2021-05-10 21:10:34 +01:00
streambuf libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
string Update copyright years. 2021-01-04 10:26:59 +01:00
string_view libstdc++: Fix Doxygen warning about ambiguous file name 2021-04-08 14:51:03 +01:00
syncstream Update copyright years. 2021-01-04 10:26:59 +01:00
system_error libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
thread libstdc++: Fix std::jthread assertion and re-enable skipped test 2021-05-17 17:56:57 +01:00
tuple libstdc++: Use reserved name for attribute [PR101055] 2021-06-14 11:53:29 +01:00
type_traits libstdc++: Fix common_reference for non-reference results [PR100894] 2021-06-14 21:17:53 +01:00
typeindex Update copyright years. 2021-01-04 10:26:59 +01:00
unordered_map Update copyright years. 2021-01-04 10:26:59 +01:00
unordered_set Update copyright years. 2021-01-04 10:26:59 +01:00
utility libstdc++: Add nodiscard attribute to cast-like functions 2021-04-06 16:43:25 +01:00
valarray libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
variant libstdc++: Do not use deduced return type for std::visit [PR 100384] 2021-05-04 12:16:46 +01:00
vector Update copyright years. 2021-01-04 10:26:59 +01:00
version libstdc++: Add feature test macro for heterogeneous lookup in unordered containers 2021-06-04 15:59:37 +01:00