1 | |
2 | // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, |
3 | // Howard Hinnant and John Maddock 2000. |
4 | // (C) Copyright Mat Marcus, Jesse Jones and Adobe Systems Inc 2001 |
5 | |
6 | // Use, modification and distribution are subject to the Boost Software License, |
7 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
8 | // http://www.boost.org/LICENSE_1_0.txt). |
9 | // |
10 | // See http://www.boost.org/libs/type_traits for most recent version including documentation. |
11 | |
12 | // Fixed is_pointer, is_reference, is_const, is_volatile, is_same, |
13 | // is_member_pointer based on the Simulated Partial Specialization work |
14 | // of Mat Marcus and Jesse Jones. See http://opensource.adobe.com or |
15 | // http://groups.yahoo.com/group/boost/message/5441 |
16 | // Some workarounds in here use ideas suggested from "Generic<Programming>: |
17 | // Mappings between Types and Values" |
18 | // by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html). |
19 | |
20 | |
21 | #ifndef BOOST_TT_IS_POINTER_HPP_INCLUDED |
22 | #define BOOST_TT_IS_POINTER_HPP_INCLUDED |
23 | |
24 | #include <boost/type_traits/is_member_pointer.hpp> |
25 | #include <boost/type_traits/detail/ice_and.hpp> |
26 | #include <boost/type_traits/detail/ice_not.hpp> |
27 | #include <boost/type_traits/config.hpp> |
28 | #include <boost/type_traits/remove_cv.hpp> |
29 | |
30 | |
31 | // should be the last #include |
32 | #include <boost/type_traits/detail/bool_trait_def.hpp> |
33 | |
34 | namespace boost { |
35 | |
36 | #if defined( __CODEGEARC__ ) |
37 | BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pointer,T,__is_pointer(T)) |
38 | #else |
39 | |
40 | namespace detail { |
41 | |
42 | template< typename T > struct is_pointer_helper |
43 | { |
44 | BOOST_STATIC_CONSTANT(bool, value = false); |
45 | }; |
46 | |
47 | # define TT_AUX_BOOL_TRAIT_HELPER_PARTIAL_SPEC(helper,sp,result) \ |
48 | template< typename T > struct helper<sp> \ |
49 | { \ |
50 | BOOST_STATIC_CONSTANT(bool, value = result); \ |
51 | }; \ |
52 | /**/ |
53 | |
54 | TT_AUX_BOOL_TRAIT_HELPER_PARTIAL_SPEC(is_pointer_helper,T*,true) |
55 | |
56 | # undef TT_AUX_BOOL_TRAIT_HELPER_PARTIAL_SPEC |
57 | |
58 | template< typename T > |
59 | struct is_pointer_impl |
60 | { |
61 | BOOST_STATIC_CONSTANT(bool, value = |
62 | (::boost::type_traits::ice_and< |
63 | ::boost::detail::is_pointer_helper<typename remove_cv<T>::type>::value |
64 | , ::boost::type_traits::ice_not< |
65 | ::boost::is_member_pointer<T>::value |
66 | >::value |
67 | >::value) |
68 | ); |
69 | }; |
70 | |
71 | } // namespace detail |
72 | |
73 | BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pointer,T,::boost::detail::is_pointer_impl<T>::value) |
74 | |
75 | #if defined(__BORLANDC__) && !defined(__COMO__) && (__BORLANDC__ < 0x600) |
76 | BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T&,false) |
77 | BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T& const,false) |
78 | BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T& volatile,false) |
79 | BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T& const volatile,false) |
80 | #endif |
81 | |
82 | #endif |
83 | |
84 | } // namespace boost |
85 | |
86 | #include <boost/type_traits/detail/bool_trait_undef.hpp> |
87 | |
88 | #endif // BOOST_TT_IS_POINTER_HPP_INCLUDED |
89 | |