]> git.lyx.org Git - lyx.git/blob - boost/boost/type_traits/is_array.hpp
update to boost 1.30.1
[lyx.git] / boost / boost / type_traits / is_array.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_ARRAY_HPP_INCLUDED
12 #define BOOST_TT_IS_ARRAY_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 #include <cstddef>
22
23 // should be the last #include
24 #include "boost/type_traits/detail/bool_trait_def.hpp"
25
26 namespace boost {
27
28 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
29
30 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_array,T,false)
31 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T[N],true)
32 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T const[N],true)
33 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T volatile[N],true)
34 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T const volatile[N],true)
35
36 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
37
38 namespace detail {
39
40 using ::boost::type_traits::yes_type;
41 using ::boost::type_traits::no_type;
42 using ::boost::type_traits::wrap;
43
44 template< typename T > T(* is_array_tester1(wrap<T>) )(wrap<T>);
45 char BOOST_TT_DECL is_array_tester1(...);
46
47 template< typename T> no_type is_array_tester2(T(*)(wrap<T>));
48 yes_type BOOST_TT_DECL is_array_tester2(...);
49
50 template< typename T >
51 struct is_array_impl
52
53     BOOST_STATIC_CONSTANT(bool, value = 
54         sizeof(::boost::detail::is_array_tester2(
55             ::boost::detail::is_array_tester1(
56                 ::boost::type_traits::wrap<T>()
57                 )
58         )) == 1
59     );
60 };
61
62 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
63 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void,false)
64 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void const,false)
65 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void volatile,false)
66 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void const volatile,false)
67 #endif
68
69 } // namespace detail
70
71 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_array,T,::boost::detail::is_array_impl<T>::value)
72
73 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
74
75 } // namespace boost
76
77 #include "boost/type_traits/detail/bool_trait_undef.hpp"
78
79 #endif // BOOST_TT_IS_ARRAY_HPP_INCLUDED