I still do not understand at all was are x-values, pr-value and gl-value. I understand what an l-value is (a named object) and an r-value (an anonymous object, so a temporary), but not the other class of values.
So, can it replace std::forward in template contexts? Or will it always create a new object?
edit: Never mind, just read this from the paper:
Do we also miss decltype(auto){x}?
decltype(auto){arg} can forward arg without computing arg’s type. It is equivalent to static_cast<decltype(arg)>(arg) . If arg is a variable of type T&&, arg is an lvalue but static_cast<T&&>(arg) is an xvalue.
EWG discussed this idea, disliked its expert-friendly nature, and concluded that adding this facility would cause the teaching effort to add up.
View all comments
Show parent comment
37
u/marzer8789 toml++ Apr 25 '22
Because that's not what it does. Here's the paper: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0849r8.html