Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 1 | // add_rvalue_reference.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_ADD_RVALUE_REFERENCE__HPP |
| 9 | #define BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP |
| 10 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 11 | #include <ndnboost/config.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 12 | |
| 13 | //----------------------------------------------------------------------------// |
| 14 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 15 | #include <ndnboost/type_traits/is_void.hpp> |
| 16 | #include <ndnboost/type_traits/is_reference.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 17 | |
| 18 | // should be the last #include |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 19 | #include <ndnboost/type_traits/detail/type_trait_def.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 20 | |
| 21 | //----------------------------------------------------------------------------// |
| 22 | // // |
| 23 | // C++03 implementation of // |
| 24 | // 20.9.7.2 Reference modifications [meta.trans.ref] // |
| 25 | // Written by Vicente J. Botet Escriba // |
| 26 | // // |
| 27 | // If T names an object or function type then the member typedef type |
| 28 | // shall name T&&; otherwise, type shall name T. [ Note: This rule reflects |
| 29 | // the semantics of reference collapsing. For example, when a type T names |
| 30 | // a type T1&, the type add_rvalue_reference<T>::type is not an rvalue |
| 31 | // reference. -end note ] |
| 32 | //----------------------------------------------------------------------------// |
| 33 | |
| 34 | namespace ndnboost { |
| 35 | |
| 36 | namespace type_traits_detail { |
| 37 | |
| 38 | template <typename T, bool b> |
| 39 | struct add_rvalue_reference_helper |
| 40 | { typedef T type; }; |
| 41 | |
| 42 | #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
| 43 | template <typename T> |
| 44 | struct add_rvalue_reference_helper<T, true> |
| 45 | { |
| 46 | typedef T&& type; |
| 47 | }; |
| 48 | #endif |
| 49 | |
| 50 | template <typename T> |
| 51 | struct add_rvalue_reference_imp |
| 52 | { |
| 53 | typedef typename ndnboost::type_traits_detail::add_rvalue_reference_helper |
| 54 | <T, (is_void<T>::value == false && is_reference<T>::value == false) >::type type; |
| 55 | }; |
| 56 | |
| 57 | } |
| 58 | |
| 59 | BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_rvalue_reference,T,typename ndnboost::type_traits_detail::add_rvalue_reference_imp<T>::type) |
| 60 | |
| 61 | } // namespace ndnboost |
| 62 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 63 | #include <ndnboost/type_traits/detail/type_trait_undef.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 64 | |
| 65 | #endif // BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP |
| 66 | |