declval.qbk 736 B

123456789101112131415161718192021
  1. [/
  2. Copyright 2015 Peter Dimov.
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. ]
  7. [section:declval declval]
  8. template <class T>
  9. typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand
  10. __std_ref C++11 20.2.4 [declval].
  11. __header ` #include <boost/type_traits/declval.hpp>` or ` #include <boost/type_traits.hpp>`
  12. The function template `declval` is used when a value of a certain type is required in
  13. a type computation context. For example, the type of the result of adding an `int` and
  14. a `float` can be obtained with the expression `decltype( declval<int>() + declval<float>() )`.
  15. [endsect]