Returns std::forward<T>(value) (implicitly converted to the decayed type), a decayed prvalue copy of value.
[edit] Parameters value - the value to be copied [edit] Return valueA decayed copy of value as a prvalue.
[edit] Notesdecay-copy
was introduced by the resolution of LWG issue 929. It is initially used in the concurrency support library to ensure that arguments are decayed when passing-by-value, and is later used in the ranges library.
The language feature auto(x) introduced in C++23 also allows decayed copies to be created as prvalues. The only difference is that decay-copy
always materializes value and produces a copy, while auto(expr) is a no-op if expr is a prvalue.
All usages of decay-copy
in the standard library (see below) except views::all, ranges::take_view and ranges::drop_view are replaced with auto(x) since C++23.
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior LWG 3724 C++20decay-copy
was not constrained constrained [edit] See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4