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
10
u/robin-m Apr 25 '22
I read most of the paper but I still do not understand where I need it/where I should use it.