1 // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
2 // Hinnant & John Maddock 2000. Permission to copy, use, modify,
3 // sell and distribute this software is granted provided this
4 // copyright notice appears in all copies. This software is provided
5 // "as is" without express or implied warranty, and with no claim as
6 // to its suitability for any purpose.
8 // See http://www.boost.org for most recent version including documentation.
10 #ifndef BOOST_TT_ARRAY_TRAITS_HPP
11 # define BOOST_TT_ARRAY_TRAITS_HPP
13 # include <boost/type_traits/utility.hpp>
14 # include <boost/type_traits/ice.hpp>
18 /**********************************************
22 **********************************************/
23 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
24 template <typename T> struct is_array
25 { BOOST_STATIC_CONSTANT(bool, value = false); };
26 template <typename T, std::size_t N> struct is_array<T[N]>
27 { BOOST_STATIC_CONSTANT(bool, value = true); };
28 template <typename T, std::size_t N> struct is_array<const T[N]>
29 { BOOST_STATIC_CONSTANT(bool, value = true); };
30 template <typename T, std::size_t N> struct is_array<volatile T[N]>
31 { BOOST_STATIC_CONSTANT(bool, value = true); };
32 template <typename T, std::size_t N> struct is_array<const volatile T[N]>
33 { BOOST_STATIC_CONSTANT(bool, value = true); };
34 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
37 using ::boost::type_traits::yes_type;
38 using ::boost::type_traits::no_type;
39 using ::boost::type_traits::wrap;
41 template <class T> T(* is_array_helper1(wrap<T>) )(wrap<T>);
42 char is_array_helper1(...);
44 template <class T> no_type is_array_helper2(T(*)(wrap<T>));
45 yes_type is_array_helper2(...);
52 BOOST_STATIC_CONSTANT(
54 ::boost::detail::is_array_helper2(
55 ::boost::detail::is_array_helper1(
56 ::boost::type_traits::wrap<T>()))) == 1
63 BOOST_STATIC_CONSTANT(bool, value = false);
66 # ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
68 struct is_array<const void>
70 BOOST_STATIC_CONSTANT(bool, value = false);
73 struct is_array<volatile void>
75 BOOST_STATIC_CONSTANT(bool, value = false);
78 struct is_array<const volatile void>
80 BOOST_STATIC_CONSTANT(bool, value = false);
83 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
87 #endif // BOOST_TT_ARRAY_TRAITS_HPP