2 // Copyright 2000 John Maddock (john@johnmaddock.co.uk)
3 // Copyright 2002 Aleksey Gurtovoy (agurtovoy@meta-comm.com)
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).
9 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
11 #ifndef BOOST_TT_IS_FUNCTION_HPP_INCLUDED
12 #define BOOST_TT_IS_FUNCTION_HPP_INCLUDED
14 #include <boost/type_traits/is_reference.hpp>
15 #include <boost/type_traits/detail/false_result.hpp>
16 #include <boost/config.hpp>
18 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
19 # include <boost/type_traits/detail/is_function_ptr_helper.hpp>
21 # include <boost/type_traits/detail/is_function_ptr_tester.hpp>
22 # include <boost/type_traits/detail/yes_no_type.hpp>
25 // should be the last #include
26 #include <boost/type_traits/detail/bool_trait_def.hpp>
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*.
37 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
38 template<bool is_ref = true>
39 struct is_function_chooser
40 : ::boost::type_traits::false_result
45 struct is_function_chooser<false>
47 template< typename T > struct result_
48 : ::boost::type_traits::is_function_ptr_helper<T*>
54 struct is_function_impl
55 : is_function_chooser< ::boost::is_reference<T>::value >
56 ::BOOST_NESTED_TEMPLATE result_<T>
63 struct is_function_impl
65 #if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
67 #pragma warning(disable:6334)
70 BOOST_STATIC_CONSTANT(
71 bool, value = sizeof(::boost::type_traits::is_function_ptr_tester(t))
72 == sizeof(::boost::type_traits::yes_type)
74 #if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
79 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
81 struct is_function_impl<T&> : public false_type
89 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,::boost::detail::is_function_impl<T>::value)
93 #include <boost/type_traits/detail/bool_trait_undef.hpp>
95 #endif // BOOST_TT_IS_FUNCTION_HPP_INCLUDED