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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 8 | #ifndef NDNBOOST_TYPE_TRAITS_EXT_DECLVAL__HPP |
| 9 | #define NDNBOOST_TYPE_TRAITS_EXT_DECLVAL__HPP |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 40 | //#if !defined(NDNBOOST_NO_RVALUE_REFERENCES) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 41 | template <typename T> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 42 | typename add_rvalue_reference<T>::type declval() NDNBOOST_NOEXCEPT; // as unevaluated operand |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 43 | //#else |
| 44 | // template <typename T> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 45 | // typename add_lvalue_reference<T>::type declval() NDNBOOST_NOEXCEPT; // as unevaluated operand |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 46 | //#endif |
| 47 | } // namespace ndnboost |
| 48 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 49 | #endif // NDNBOOST_TYPE_TRAITS_EXT_DECLVAL__HPP |