]> git.donarmstrong.com Git - rsem.git/blob - boost/type_traits/add_rvalue_reference.hpp
Updated boost to v1.55.0
[rsem.git] / boost / type_traits / add_rvalue_reference.hpp
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
11 #include <boost/config.hpp>
12
13 //----------------------------------------------------------------------------//
14
15 #include <boost/type_traits/is_void.hpp>
16 #include <boost/type_traits/is_reference.hpp>
17
18 // should be the last #include
19 #include <boost/type_traits/detail/type_trait_def.hpp>
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 boost {
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 boost::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 boost::type_traits_detail::add_rvalue_reference_imp<T>::type)
60
61 }  // namespace boost
62
63 #include <boost/type_traits/detail/type_trait_undef.hpp>
64
65 #endif  // BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
66