summaryrefslogtreecommitdiffstats
path: root/contrib/src/boost/type_traits/add_rvalue_reference.hpp
blob: e32cd96cff633fb2cc88f808dde671ccdca35e75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//  add_rvalue_reference.hpp  ---------------------------------------------------------//


//  Copyright 2010 Vicente J. Botet Escriba


//  Distributed under the Boost Software License, Version 1.0.

//  See http://www.boost.org/LICENSE_1_0.txt


#ifndef BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP

#define BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP


#include <boost/config.hpp>


//----------------------------------------------------------------------------//


#include <boost/type_traits/is_void.hpp>

#include <boost/type_traits/is_reference.hpp>


//----------------------------------------------------------------------------//

//                                                                            //

//                           C++03 implementation of                          //

//             20.9.7.2 Reference modifications [meta.trans.ref]              //

//                          Written by Vicente J. Botet Escriba               //

//                                                                            //

// If T names an object or function type then the member typedef type

// shall name T&&; otherwise, type shall name T. [ Note: This rule reflects

// the semantics of reference collapsing. For example, when a type T names

// a type T1&, the type add_rvalue_reference<T>::type is not an rvalue

// reference. -end note ]

//----------------------------------------------------------------------------//


namespace boost {

namespace type_traits_detail {

    template <typename T, bool b>
    struct add_rvalue_reference_helper
    { typedef T   type; };

#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)

    template <typename T>
    struct add_rvalue_reference_helper<T, true>
    {
        typedef T&&   type;
    };
#endif


    template <typename T>
    struct add_rvalue_reference_imp
    {
       typedef typename boost::type_traits_detail::add_rvalue_reference_helper
                  <T, (is_void<T>::value == false && is_reference<T>::value == false) >::type type;
    };

}

template <class T> struct add_rvalue_reference
{
   typedef typename boost::type_traits_detail::add_rvalue_reference_imp<T>::type type;
};

}  // namespace boost


#endif  // BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP