]> git.lyx.org Git - lyx.git/blob - boost/boost/type_traits/is_volatile.hpp
update to boost 1.30.1
[lyx.git] / boost / boost / type_traits / is_volatile.hpp
1
2 // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
3 // Hinnant & John Maddock 2000.  Permission to copy, use, modify,
4 // 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_VOLATILE_HPP_INCLUDED
12 #define BOOST_TT_IS_VOLATILE_HPP_INCLUDED
13
14 #include "boost/config.hpp"
15
16 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
17 #   include "boost/type_traits/detail/cv_traits_impl.hpp"
18 #else
19 #   include "boost/type_traits/is_reference.hpp"
20 #   include "boost/type_traits/is_array.hpp"
21 #   include "boost/type_traits/detail/yes_no_type.hpp"
22 #   include "boost/type_traits/detail/false_result.hpp"
23 #endif
24
25 // should be the last #include
26 #include "boost/type_traits/detail/bool_trait_def.hpp"
27
28 namespace boost {
29
30 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
31
32 //* is a type T declared volatile - is_volatile<T>
33 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::cv_traits_imp<T*>::is_volatile)
34 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T&,false)
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_volatile,T& const,false)
42 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T& volatile,false)
43 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T& const volatile,false)
44 #endif
45
46 #else
47
48 namespace detail {
49
50 using ::boost::type_traits::yes_type;
51 using ::boost::type_traits::no_type;
52
53 yes_type is_volatile_tester(void const volatile*);
54 no_type is_volatile_tester(void const*);
55
56 template <bool is_ref, bool array>
57 struct is_volatile_helper
58     : ::boost::type_traits::false_result
59 {
60 };
61
62 template <>
63 struct is_volatile_helper<false,false>
64 {
65     template <typename T> struct result_
66     {
67         static T* t;
68         BOOST_STATIC_CONSTANT(bool, value = (
69             sizeof(detail::yes_type) == sizeof(detail::is_volatile_tester(t))
70             ));
71     };      
72 };
73
74 template <>
75 struct is_volatile_helper<false,true>
76 {
77     template <typename T> struct result_
78     {
79         static T t;
80         BOOST_STATIC_CONSTANT(bool, value = (
81             sizeof(detail::yes_type) == sizeof(detail::is_volatile_tester(&t))
82             ));
83     };      
84 };
85
86 template <typename T>
87 struct is_volatile_impl
88     : is_volatile_helper<
89           is_reference<T>::value
90         , is_array<T>::value
91         >::template result_<T>
92
93 };
94
95 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_volatile,void,false)
96 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
97 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_volatile,void const,false)
98 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_volatile,void volatile,true)
99 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_volatile,void const volatile,true)
100 #endif
101
102 } // namespace detail
103
104 //* is a type T declared volatile - is_volatile<T>
105 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::is_volatile_impl<T>::value)
106
107 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
108
109 } // namespace boost
110
111 #include "boost/type_traits/detail/bool_trait_undef.hpp"
112
113 #endif // BOOST_TT_IS_VOLATILE_HPP_INCLUDED