Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Function template value



// In header: <boost/yap/algorithm.hpp>

template<typename T> decltype(auto) constexpr value(T && x);


Forwards the sole element of x to the caller, possibly calling deref() first if x is a reference expression, or forwards x to the caller unchanged.

More formally:

  • If x is not an expression, x is forwarded to the caller.

  • Otherwise, if x is a reference expression, the result is value(deref(x)).

  • Otherwise, if x is an expression with only one value (a unary expression or a terminal expression), the result is the forwarded first element of x.

  • Otherwise, x is forwarded to the caller.