]> git.lyx.org Git - lyx.git/blob - boost/boost/type_traits/is_reference.hpp
update boost to version 1.29.0
[lyx.git] / boost / boost / type_traits / is_reference.hpp
1
2 //  (C) Copyright David Abrahams Steve Cleary, Beman Dawes, Howard
3 //  Hinnant & John Maddock 2000-2002.  Permission to copy, use,
4 //  modify, sell and distribute this software is granted provided this
5 //  copyright notice appears in all copies. This software is provided
6 //  "as is" without express or implied warranty, and with no claim as
7 //  to its suitability for any purpose.
8 //
9 //  See http://www.boost.org for most recent version including documentation.
10
11 #ifndef BOOST_TT_IS_REFERENCE_HPP_INCLUDED
12 #define BOOST_TT_IS_REFERENCE_HPP_INCLUDED
13
14 #include "boost/type_traits/config.hpp"
15
16 #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
17 #   include "boost/type_traits/detail/yes_no_type.hpp"
18 #   include "boost/type_traits/detail/wrap.hpp"
19 #endif
20
21 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && defined(BOOST_MSVC)
22 #   include "boost/type_traits/detail/is_function_type_tester.hpp"
23 #   include "boost/type_traits/detail/false_result.hpp"
24 #endif
25
26 // should be the last #include
27 #include "boost/type_traits/detail/bool_trait_def.hpp"
28
29 namespace boost { 
30
31 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
32
33 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,false)
34 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T&,true)
35
36 #if defined(__BORLANDC__)
37 // these are illegal specialisations; cv-qualifies applied to
38 // references have no effect according to [8.3.2p1],
39 // C++ Builder requires them though as it treats cv-qualified
40 // references as distinct types...
41 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T& const,true)
42 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T& volatile,true)
43 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T& const volatile,true)
44 #endif
45
46 #else
47
48 #ifdef BOOST_MSVC
49 #   pragma warning(push)
50 #   pragma warning(disable: 4181)
51 #endif
52
53 namespace detail {
54
55 using ::boost::type_traits::yes_type;
56 using ::boost::type_traits::no_type;
57 using ::boost::type_traits::wrap;
58
59 template <class T> T&(* is_reference_helper1(wrap<T>) )(wrap<T>);
60 char is_reference_helper1(...);
61
62 template <class T> no_type is_reference_helper2(T&(*)(wrap<T>));
63 yes_type is_reference_helper2(...);
64
65 template <typename T>
66 struct is_reference_impl
67 {
68     BOOST_STATIC_CONSTANT(
69         bool, value = sizeof(
70             ::boost::detail::is_reference_helper2(
71                 ::boost::detail::is_reference_helper1(::boost::type_traits::wrap<T>()))) == 1
72         );
73 };
74
75 } // namespace detail
76
77 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,::boost::detail::is_reference_impl<T>::value)
78 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void,false)
79 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
80 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void const,false)
81 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void volatile,false)
82 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void const volatile,false)
83 #endif
84
85 #ifdef BOOST_MSVC
86 #   pragma warning(pop)
87 #endif
88
89 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
90
91 } // namespace boost
92
93 #include "boost/type_traits/detail/bool_trait_undef.hpp"
94
95 #endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED