fixing stuff
[dyninst.git] / dynutil / h / dyn_detail / boost / type_traits / is_function.hpp
1
2 //  Copyright 2000 John Maddock (john@johnmaddock.co.uk)
3 //  Copyright 2002 Aleksey Gurtovoy (agurtovoy@meta-comm.com)
4 //
5 //  Use, modification and distribution are subject to the Boost Software License,
6 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 //  http://www.boost.org/LICENSE_1_0.txt).
8 //
9 //  See http://www.boost.org/libs/type_traits for most recent version including documentation.
10
11 #ifndef DYN_DETAIL_BOOST_TT_IS_FUNCTION_HPP_INCLUDED
12 #define DYN_DETAIL_BOOST_TT_IS_FUNCTION_HPP_INCLUDED
13
14 #include <dyn_detail/boost/type_traits/is_reference.hpp>
15 #include <dyn_detail/boost/type_traits/detail/false_result.hpp>
16 #include <dyn_detail/boost/config.hpp>
17
18 #if !defined(DYN_DETAIL_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(DYN_DETAIL_BOOST_TT_TEST_MS_FUNC_SIGS)
19 #   include <dyn_detail/boost/type_traits/detail/is_function_ptr_helper.hpp>
20 #else
21 #   include <dyn_detail/boost/type_traits/detail/is_function_ptr_tester.hpp>
22 #   include <dyn_detail/boost/type_traits/detail/yes_no_type.hpp>
23 #endif
24
25 // should be the last #include
26 #include <dyn_detail/boost/type_traits/detail/bool_trait_def.hpp>
27
28 // is a type a function?
29 // Please note that this implementation is unnecessarily complex:
30 // we could just use !is_convertible<T*, const volatile void*>::value,
31 // except that some compilers erroneously allow conversions from
32 // function pointers to void*.
33
34 namespace dyn_detail {
35 namespace boost {
36
37 #if !defined( __CODEGEARC__ )
38
39 namespace detail {
40
41 #if !defined(DYN_DETAIL_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(DYN_DETAIL_BOOST_TT_TEST_MS_FUNC_SIGS)
42 template<bool is_ref = true>
43 struct is_function_chooser
44     : ::dyn_detail::boost::type_traits::false_result
45 {
46 };
47
48 template <>
49 struct is_function_chooser<false>
50 {
51     template< typename T > struct result_
52         : ::dyn_detail::boost::type_traits::is_function_ptr_helper<T*>
53     {
54     };
55 };
56
57 template <typename T>
58 struct is_function_impl
59     : is_function_chooser< ::dyn_detail::boost::is_reference<T>::value >
60         ::DYN_DETAIL_BOOST_NESTED_TEMPLATE result_<T>
61 {
62 };
63
64 #else
65
66 template <typename T>
67 struct is_function_impl
68 {
69 #if DYN_DETAIL_BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
70 #pragma warning(push)
71 #pragma warning(disable:6334)
72 #endif
73     static T* t;
74     DYN_DETAIL_BOOST_STATIC_CONSTANT(
75         bool, value = sizeof(::dyn_detail::boost::type_traits::is_function_ptr_tester(t))
76         == sizeof(::dyn_detail::boost::type_traits::yes_type)
77         );
78 #if DYN_DETAIL_BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
79 #pragma warning(pop)
80 #endif
81 };
82
83 #if !defined(DYN_DETAIL_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
84 template <typename T>
85 struct is_function_impl<T&> : public false_type
86 {};
87 #endif
88
89 #endif
90
91 } // namespace detail
92
93 #endif // !defined( __CODEGEARC__ )
94
95 #if defined( __CODEGEARC__ )
96 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,__is_function(T))
97 #else
98 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,::dyn_detail::boost::detail::is_function_impl<T>::value)
99 #endif
100 } // namespace boost
101 } // namespace dyn_detail
102
103 #include <dyn_detail/boost/type_traits/detail/bool_trait_undef.hpp>
104
105 #endif // DYN_DETAIL_BOOST_TT_IS_FUNCTION_HPP_INCLUDED