![]() |
Home | Libraries | People | FAQ | More |
boost::forward_like
// In header: <boost/move/utility_core.hpp> template<typename T> output_reference forward_like(input_reference);
Forwards x (usually a member or a base of an object of type T) with the value category of T, as C++23 std::forward_like: the result is an lvalue if T is an lvalue reference, otherwise an rvalue. The result is const if x is const or if remove_reference<T>::type is const.
Typical use, where T is the template parameter of a forwarding reference: template<class T> void f(BOOST_FWD_REF(T) t) { g(boost::forward_like<T>(t.member)); }
Note: as std::forward_like, the category of the object x refers to is changed: if x is a reference member, the object it refers to is forwarded as an rvalue.