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.
9 // See http://www.boost.org for most recent version including documentation.
11 #ifndef BOOST_TT_IS_VOLATILE_HPP_INCLUDED
12 #define BOOST_TT_IS_VOLATILE_HPP_INCLUDED
14 #include "boost/config.hpp"
16 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
17 # include "boost/type_traits/detail/cv_traits_impl.hpp"
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"
25 // should be the last #include
26 #include "boost/type_traits/detail/bool_trait_def.hpp"
30 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
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)
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)
50 using ::boost::type_traits::yes_type;
51 using ::boost::type_traits::no_type;
53 yes_type is_volatile_tester(void const volatile*);
54 no_type is_volatile_tester(void const*);
56 template <bool is_ref, bool array>
57 struct is_volatile_helper
58 : ::boost::type_traits::false_result
63 struct is_volatile_helper<false,false>
65 template <typename T> struct result_
68 BOOST_STATIC_CONSTANT(bool, value = (
69 sizeof(detail::yes_type) == sizeof(detail::is_volatile_tester(t))
75 struct is_volatile_helper<false,true>
77 template <typename T> struct result_
80 BOOST_STATIC_CONSTANT(bool, value = (
81 sizeof(detail::yes_type) == sizeof(detail::is_volatile_tester(&t))
87 struct is_volatile_impl
89 is_reference<T>::value
91 >::template result_<T>
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)
102 } // namespace detail
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)
107 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
111 #include "boost/type_traits/detail/bool_trait_undef.hpp"
113 #endif // BOOST_TT_IS_VOLATILE_HPP_INCLUDED