]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/ratio/example/type_traits/declval.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / ratio / example / type_traits / declval.hpp
1 // common_type.hpp ---------------------------------------------------------//
2
3 // Copyright 2010 Vicente J. Botet Escriba
4
5 // Distributed under the Boost Software License, Version 1.0.
6 // See http://www.boost.org/LICENSE_1_0.txt
7
8 #ifndef BOOST_EX_TYPE_TRAITS_EXT_DECLVAL__HPP
9 #define BOOST_EX_TYPE_TRAITS_EXT_DECLVAL__HPP
10
11 #include <boost/config.hpp>
12
13 //----------------------------------------------------------------------------//
14
15 #include "add_rvalue_reference.hpp"
16
17 //----------------------------------------------------------------------------//
18 // //
19 // C++03 implementation of //
20 // Written by Vicente J. Botet Escriba //
21 //~ 20.3.4 Function template declval [declval]
22 //~ 1 The library provides the function template declval to simplify the definition of expressions which occur as
23 //~ unevaluated operands.
24 //~ 2 Remarks: If this function is used, the program is ill-formed.
25 //~ 3 Remarks: The template parameter T of declval may be an incomplete type.
26 //~ [ Example:
27
28 //~ template <class To, class From>
29 //~ decltype(static_cast<To>(declval<From>())) convert(From&&);
30
31 //~ declares a function template convert which only participats in overloading if the type From can be
32 //~ explicitly converted to type To. For another example see class template common_type (20.7.6.6). -end
33 //~ example ]
34 // //
35 //----------------------------------------------------------------------------//
36
37 namespace boost_ex {
38
39 template <typename T>
40 typename add_rvalue_reference<T>::type declval(); //noexcept; // as unevaluated operand
41
42 } // namespace boost
43
44 #endif // BOOST_EX_TYPE_TRAITS_EXT_DECLVAL__HPP