]> git.lyx.org Git - lyx.git/blob - boost/boost/type_traits/is_array.hpp
update boost to version 1.36
[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.  
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).
7 //
8 //  See http://www.boost.org/libs/type_traits for most recent version including documentation.
9
10
11 // Some fixes for is_array are based on a newgroup posting by Jonathan Lundquist.
12
13
14 #ifndef BOOST_TT_IS_ARRAY_HPP_INCLUDED
15 #define BOOST_TT_IS_ARRAY_HPP_INCLUDED
16
17 #include <boost/type_traits/config.hpp>
18
19 #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
20 #   include <boost/type_traits/detail/yes_no_type.hpp>
21 #   include <boost/type_traits/detail/wrap.hpp>
22 #endif
23
24 #include <cstddef>
25
26 // should be the last #include
27 #include <boost/type_traits/detail/bool_trait_def.hpp>
28
29 namespace boost {
30
31 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
32
33 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_array,T,false)
34 #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
35 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T[N],true)
36 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T const[N],true)
37 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T volatile[N],true)
38 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T const volatile[N],true)
39 #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) &&  !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
40 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T[],true)
41 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T const[],true)
42 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T volatile[],true)
43 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_array,T const volatile[],true)
44 #endif
45 #endif
46
47 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
48
49 namespace detail {
50
51 using ::boost::type_traits::yes_type;
52 using ::boost::type_traits::no_type;
53 using ::boost::type_traits::wrap;
54
55 template< typename T > T(* is_array_tester1(wrap<T>) )(wrap<T>);
56 char BOOST_TT_DECL is_array_tester1(...);
57
58 template< typename T> no_type is_array_tester2(T(*)(wrap<T>));
59 yes_type BOOST_TT_DECL is_array_tester2(...);
60
61 template< typename T >
62 struct is_array_impl
63
64     BOOST_STATIC_CONSTANT(bool, value = 
65         sizeof(::boost::detail::is_array_tester2(
66             ::boost::detail::is_array_tester1(
67                 ::boost::type_traits::wrap<T>()
68                 )
69         )) == 1
70     );
71 };
72
73 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
74 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void,false)
75 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void const,false)
76 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void volatile,false)
77 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void const volatile,false)
78 #endif
79
80 } // namespace detail
81
82 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_array,T,::boost::detail::is_array_impl<T>::value)
83
84 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
85
86 } // namespace boost
87
88 #include <boost/type_traits/detail/bool_trait_undef.hpp>
89
90 #endif // BOOST_TT_IS_ARRAY_HPP_INCLUDED