2 // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
3 // Hinnant & John Maddock 2000.
4 // Use, modification and distribution are subject to the Boost Software License,
5 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt).
8 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
11 #ifndef BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED
12 #define BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED
14 #include <boost/config.hpp>
15 #include <boost/detail/workaround.hpp>
17 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
19 // implementation helper:
22 #if !(BOOST_WORKAROUND(__GNUC__,== 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 2))
26 #include <boost/type_traits/detail/yes_no_type.hpp>
28 namespace type_traits {
32 template <typename T> struct cv_traits_imp {};
35 struct cv_traits_imp<T*>
37 BOOST_STATIC_CONSTANT(bool, is_const = false);
38 BOOST_STATIC_CONSTANT(bool, is_volatile = false);
39 typedef T unqualified_type;
43 struct cv_traits_imp<const T*>
45 BOOST_STATIC_CONSTANT(bool, is_const = true);
46 BOOST_STATIC_CONSTANT(bool, is_volatile = false);
47 typedef T unqualified_type;
51 struct cv_traits_imp<volatile T*>
53 BOOST_STATIC_CONSTANT(bool, is_const = false);
54 BOOST_STATIC_CONSTANT(bool, is_volatile = true);
55 typedef T unqualified_type;
59 struct cv_traits_imp<const volatile T*>
61 BOOST_STATIC_CONSTANT(bool, is_const = true);
62 BOOST_STATIC_CONSTANT(bool, is_volatile = true);
63 typedef T unqualified_type;
66 #if BOOST_WORKAROUND(__GNUC__,== 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 2)
67 // We have to exclude function pointers
68 // (see http://gcc.gnu.org/bugzilla/show_bug.cgi?8503)
69 yes_type mini_funcptr_tester(...);
70 no_type mini_funcptr_tester(const volatile void*);
72 } // namespace gcc8503
73 } // namespace type_traits
77 // Use the implementation above for non function pointers
78 template <typename T, unsigned Select
79 = (unsigned)sizeof(::boost::type_traits::gcc8503::mini_funcptr_tester((T)0)) >
80 struct cv_traits_imp : ::boost::type_traits::gcc8503::cv_traits_imp<T> { };
82 // Functions are never cv-qualified
83 template <typename T> struct cv_traits_imp<T*,1>
85 BOOST_STATIC_CONSTANT(bool, is_const = false);
86 BOOST_STATIC_CONSTANT(bool, is_volatile = false);
87 typedef T unqualified_type;
95 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
97 #endif // BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED