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/config.hpp>
17 #if !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
18 # include <boost/type_traits/detail/is_function_ptr_helper.hpp>
20 # include <boost/type_traits/detail/is_function_ptr_tester.hpp>
21 # include <boost/type_traits/detail/yes_no_type.hpp>
24 // is a type a function?
25 // Please note that this implementation is unnecessarily complex:
26 // we could just use !is_convertible<T*, const volatile void*>::value,
27 // except that some compilers erroneously allow conversions from
28 // function pointers to void*.
32 #if !defined( __CODEGEARC__ )
36 #if !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
37 template<bool is_ref = true>
38 struct is_function_chooser
40 template< typename T > struct result_
41 : public false_type {};
45 struct is_function_chooser<false>
47 template< typename T > struct result_
48 : public ::boost::type_traits::is_function_ptr_helper<T*> {};
52 struct is_function_impl
53 : public is_function_chooser< ::boost::is_reference<T>::value >
54 ::BOOST_NESTED_TEMPLATE result_<T>
61 struct is_function_impl
63 #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
65 #pragma warning(disable:6334)
68 BOOST_STATIC_CONSTANT(
69 bool, value = sizeof(::boost::type_traits::is_function_ptr_tester(t))
70 == sizeof(::boost::type_traits::yes_type)
72 #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
78 struct is_function_impl<T&> : public false_type
80 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
82 struct is_function_impl<T&&> : public false_type
90 #endif // !defined( __CODEGEARC__ )
92 #if defined( __CODEGEARC__ )
93 template <class T> struct is_function : integral_constant<bool, __is_function(T)> {};
95 template <class T> struct is_function : integral_constant<bool, ::boost::detail::is_function_impl<T>::value> {};
96 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
97 template <class T> struct is_function<T&&> : public false_type {};
102 #endif // BOOST_TT_IS_FUNCTION_HPP_INCLUDED