2 // Copyright (C) 2000 John Maddock (john_maddock@compuserve.com)
3 // Copyright (C) 2002 Aleksey Gurtovoy (agurtovoy@meta-comm.com)
5 // Permission to copy and use this software is granted,
6 // provided this copyright notice appears in all copies.
7 // Permission to modify the code and to distribute modified code is granted,
8 // provided this copyright notice appears in all copies, and a notice
9 // that the code was modified is included with the copyright notice.
11 // This software is provided "as is" without express or implied warranty,
12 // and with no claim as to its suitability for any purpose.
14 #ifndef BOOST_TT_IS_FUNCTION_HPP_INCLUDED
15 #define BOOST_TT_IS_FUNCTION_HPP_INCLUDED
17 #include "boost/type_traits/is_reference.hpp"
18 #include "boost/type_traits/detail/false_result.hpp"
19 #include "boost/config.hpp"
21 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
22 # include "boost/type_traits/detail/is_function_ptr_helper.hpp"
24 # include "boost/type_traits/detail/is_function_ptr_tester.hpp"
25 # include "boost/type_traits/detail/yes_no_type.hpp"
28 // should be the last #include
29 #include "boost/type_traits/detail/bool_trait_def.hpp"
31 // is a type a function?
32 // Please note that this implementation is unnecessarily complex:
33 // we could just use !is_convertible<T*, const volatile void*>::value,
34 // except that some compilers erroneously allow conversions from
35 // function pointers to void*.
40 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
41 template<bool is_ref = true>
42 struct is_function_chooser
43 : ::boost::type_traits::false_result
48 struct is_function_chooser<false>
50 template< typename T > struct result_
51 : ::boost::type_traits::is_function_ptr_helper<T*>
57 struct is_function_impl
58 : is_function_chooser< ::boost::is_reference<T>::value >
66 struct is_function_impl
69 BOOST_STATIC_CONSTANT(
70 bool, value = sizeof(::boost::type_traits::is_function_ptr_tester(t))
71 == sizeof(::boost::type_traits::yes_type)
79 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,::boost::detail::is_function_impl<T>::value)
83 #include "boost/type_traits/detail/bool_trait_undef.hpp"
85 #endif // BOOST_TT_IS_FUNCTION_HPP_INCLUDED