Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 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_TYPE_TRAITS_EXT_DECLVAL__HPP |
| 9 | #define BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP |
| 10 | |
| 11 | #include <ndnboost/config.hpp> |
| 12 | |
| 13 | //----------------------------------------------------------------------------// |
| 14 | |
| 15 | #include <ndnboost/type_traits/add_rvalue_reference.hpp> |
| 16 | //#include <ndnboost/type_traits/add_lvalue_reference.hpp> |
| 17 | |
| 18 | //----------------------------------------------------------------------------// |
| 19 | // // |
| 20 | // C++03 implementation of // |
| 21 | // Written by Vicente J. Botet Escriba // |
| 22 | //~ 20.3.4 Function template declval [declval] |
| 23 | //~ 1 The library provides the function template declval to simplify the definition of expressions which occur as |
| 24 | //~ unevaluated operands. |
| 25 | //~ 2 Remarks: If this function is used, the program is ill-formed. |
| 26 | //~ 3 Remarks: The template parameter T of declval may be an incomplete type. |
| 27 | //~ [ Example: |
| 28 | |
| 29 | //~ template <class To, class From> |
| 30 | //~ decltype(static_cast<To>(declval<From>())) convert(From&&); |
| 31 | |
| 32 | //~ declares a function template convert which only participats in overloading if the type From can be |
| 33 | //~ explicitly converted to type To. For another example see class template common_type (20.7.6.6). —end |
| 34 | //~ example ] |
| 35 | // // |
| 36 | //----------------------------------------------------------------------------// |
| 37 | |
| 38 | namespace ndnboost { |
| 39 | |
| 40 | //#if !defined(BOOST_NO_RVALUE_REFERENCES) |
| 41 | template <typename T> |
| 42 | typename add_rvalue_reference<T>::type declval() BOOST_NOEXCEPT; // as unevaluated operand |
| 43 | //#else |
| 44 | // template <typename T> |
| 45 | // typename add_lvalue_reference<T>::type declval() BOOST_NOEXCEPT; // as unevaluated operand |
| 46 | //#endif |
| 47 | } // namespace ndnboost |
| 48 | |
| 49 | #endif // BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP |