Files
gcc/libstdc++-v3/include
Patrick Palka e73a6d9827 libstdc++: Implement P0849R8 auto(x) library changes
This implements the library changes in P0849R8 "auto(x): decay-copy
in the language" which consist of replacing most uses of the
exposition-only function decay-copy with auto(x) throughout the library
wording.  We implement this as a DR against C++20 since there should be
no behavior change in practice (especially in light of LWG 3724 which
makes decay-copy SFINAE-friendly).

The main difference between decay-copy and auto(x) is that decay-copy
materializes its argument unlike auto(x), and so the latter is a no-op
when its argument is a prvalue.  Effectively the former could introduce
an unnecessary move constructor call in some contexts.  In C++20 and
earlier we could emulate auto(x) with decay_t<decltype((x))>(x).

After this paper the only remaining uses of decay-copy in the standard
are in the specification of some range adaptors.  In our implementation
of those range adaptors I believe decay-copy is already implied which is
why we don't use __decay_copy explicitly there.  So since it's apparently
no longer needed this patch goes ahead and removes __decay_copy.

libstdc++-v3/ChangeLog:

	* include/bits/c++config (_GLIBCXX_AUTO_CAST): Define.
	* include/bits/iterator_concepts.h (_Decay_copy, __decay_copy):
	Remove.
	(__member_begin, __adl_begin): Use _GLIBCXX_AUTO_CAST instead of
	__decay_copy as per P0849R8.
	* include/bits/ranges_base.h (_Begin): Likewise.
	(__member_end, __adl_end, _End): Likewise.
	(__member_rbegin, __adl_rbegin, _RBegin): Likewise.
	(__member_rend, __adl_rend, _Rend): Likewise.
	(__member_size, __adl_size, _Size): Likewise.
	(_Data): Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-06-04 14:55:40 -04:00
..
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00