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.


template <class T>
typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand

C++ Standard Reference: C++11 20.2.4 [declval].

Header: #include <boost/type_traits/declval.hpp> or #include <boost/type_traits.hpp>

The function template declval is used when a value of a certain type is required in a type computation context. For example, the type of the result of adding an int and a float can be obtained with the expression decltype( declval<int>() + declval<float>() ).