]> git.lyx.org Git - lyx.git/blob - boost/boost/type_traits/add_reference.hpp
update to boost 1.30.1
[lyx.git] / boost / boost / type_traits / add_reference.hpp
1
2 // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
3 // Permission to copy, use, modify, sell and distribute this software is 
4 // granted provided this copyright notice appears in all copies. This software 
5 // is provided "as is" without express or implied warranty, and with no claim 
6 // as to its suitability for any purpose.
7 //
8 // See http://www.boost.org for most recent version including documentation.
9
10 #ifndef BOOST_TT_ADD_REFERENCE_HPP_INCLUDED
11 #define BOOST_TT_ADD_REFERENCE_HPP_INCLUDED
12
13 #include "boost/type_traits/is_reference.hpp"
14 #include "boost/detail/workaround.hpp"
15 #include "boost/config.hpp"
16
17 // should be the last #include
18 #include "boost/type_traits/detail/type_trait_def.hpp"
19
20 namespace boost {
21
22 namespace detail {
23
24 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && defined(BOOST_MSVC6_MEMBER_TEMPLATES)
25
26 template <bool x>
27 struct reference_adder
28 {
29     template <typename T> struct result_
30     {
31         typedef T& type;
32     };
33 };
34
35 template <>
36 struct reference_adder<true>
37 {
38     template <typename T> struct result_
39     {
40         typedef T type;
41     };
42 };
43
44 template <typename T>
45 struct add_reference_impl
46 {
47     typedef typename reference_adder<
48           ::boost::is_reference<T>::value
49         >::template result_<T> result;
50
51     typedef typename result::type type;
52 };
53
54 #else
55
56 template <typename T>
57 struct add_reference_impl
58 {
59     typedef T& type;
60 };
61
62 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
63 BOOST_TT_AUX_TYPE_TRAIT_IMPL_PARTIAL_SPEC1_1(typename T,add_reference,T&,T&)
64 #endif
65
66 #endif
67
68 // these full specialisations are always required:
69 BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void,void)
70 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
71 BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void const,void const)
72 BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void volatile,void volatile)
73 BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void const volatile,void const volatile)
74 #endif
75
76 } // namespace detail
77
78 BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,typename detail::add_reference_impl<T>::type)
79
80 // agurt, 07/mar/03: workaround Borland's ill-formed sensitivity to an additional 
81 // level of indirection, here
82 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561))
83 BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_reference,T&,T&)
84 #endif
85
86 } // namespace boost
87
88 #include "boost/type_traits/detail/type_trait_undef.hpp"
89
90 #endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED