1 // add_rvalue_reference.hpp ---------------------------------------------------------//
3 // Copyright 2010 Vicente J. Botet Escriba
5 // Distributed under the Boost Software License, Version 1.0.
6 // See http://www.boost.org/LICENSE_1_0.txt
8 #ifndef BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
9 #define BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
11 #include <boost/config.hpp>
13 //----------------------------------------------------------------------------//
15 #include <boost/type_traits/is_void.hpp>
16 #include <boost/type_traits/is_reference.hpp>
18 // should be the last #include
19 #include <boost/type_traits/detail/type_trait_def.hpp>
21 //----------------------------------------------------------------------------//
23 // C++03 implementation of //
24 // 20.9.7.2 Reference modifications [meta.trans.ref] //
25 // Written by Vicente J. Botet Escriba //
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 //----------------------------------------------------------------------------//
36 namespace type_traits_detail {
38 template <typename T, bool b>
39 struct add_rvalue_reference_helper
42 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
44 struct add_rvalue_reference_helper<T, true>
51 struct add_rvalue_reference_imp
53 typedef typename boost::type_traits_detail::add_rvalue_reference_helper
54 <T, (is_void<T>::value == false && is_reference<T>::value == false) >::type type;
59 BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_rvalue_reference,T,typename boost::type_traits_detail::add_rvalue_reference_imp<T>::type)
63 #include <boost/type_traits/detail/type_trait_undef.hpp>
65 #endif // BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP