]>
Commit | Line | Data |
---|---|---|
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 | ||
8 | [section:declval declval] | |
9 | ||
10 | template <class T> | |
11 | typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand | |
12 | ||
13 | __std_ref C++11 20.2.4 [declval]. | |
14 | ||
15 | __header ` #include <boost/type_traits/declval.hpp>` or ` #include <boost/type_traits.hpp>` | |
16 | ||
17 | The function template `declval` is used when a value of a certain type is required in | |
18 | a type computation context. For example, the type of the result of adding an `int` and | |
19 | a `float` can be obtained with the expression `decltype( declval<int>() + declval<float>() )`. | |
20 | ||
21 | [endsect] |