]> git.lyx.org Git - lyx.git/blob - 3rdparty/boost/boost/type_traits/detail/is_function_cxx_03.hpp
Update to boost 1.72
[lyx.git] / 3rdparty / boost / boost / type_traits / detail / is_function_cxx_03.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 BOOST_TT_IS_FUNCTION_CXX_03_HPP_INCLUDED
12 #define BOOST_TT_IS_FUNCTION_CXX_03_HPP_INCLUDED
13
14 #include <boost/type_traits/is_reference.hpp>
15
16 #if !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
17 #   include <boost/type_traits/detail/is_function_ptr_helper.hpp>
18 #else
19 #   include <boost/type_traits/detail/is_function_ptr_tester.hpp>
20 #   include <boost/type_traits/detail/yes_no_type.hpp>
21 #endif
22
23 // is a type a function?
24 // Please note that this implementation is unnecessarily complex:
25 // we could just use !is_convertible<T*, const volatile void*>::value,
26 // except that some compilers erroneously allow conversions from
27 // function pointers to void*.
28
29 namespace boost {
30
31 #if !defined( __CODEGEARC__ )
32
33 namespace detail {
34
35 #if !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
36 template<bool is_ref = true>
37 struct is_function_chooser
38 {
39    template< typename T > struct result_
40       : public false_type {};
41 };
42
43 template <>
44 struct is_function_chooser<false>
45 {
46     template< typename T > struct result_
47         : public ::boost::type_traits::is_function_ptr_helper<T*> {};
48 };
49
50 template <typename T>
51 struct is_function_impl
52     : public is_function_chooser< ::boost::is_reference<T>::value >
53         ::BOOST_NESTED_TEMPLATE result_<T>
54 {
55 };
56
57 #else
58
59 template <typename T>
60 struct is_function_impl
61 {
62 #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
63 #pragma warning(push)
64 #pragma warning(disable:6334)
65 #endif
66     static T* t;
67     BOOST_STATIC_CONSTANT(
68         bool, value = sizeof(::boost::type_traits::is_function_ptr_tester(t))
69         == sizeof(::boost::type_traits::yes_type)
70         );
71 #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
72 #pragma warning(pop)
73 #endif
74 };
75
76 template <typename T>
77 struct is_function_impl<T&> : public false_type
78 {};
79 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
80 template <typename T>
81 struct is_function_impl<T&&> : public false_type
82 {};
83 #endif
84
85 #endif
86
87 } // namespace detail
88
89 #endif // !defined( __CODEGEARC__ )
90
91 #if defined( __CODEGEARC__ )
92 template <class T> struct is_function : integral_constant<bool, __is_function(T)> {};
93 #else
94 template <class T> struct is_function : integral_constant<bool, ::boost::detail::is_function_impl<T>::value> {};
95 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
96 template <class T> struct is_function<T&&> : public false_type {};
97 #endif
98 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1600)
99 template <class T> struct is_function<T&> : public false_type {};
100 #endif
101 #endif
102 } // namespace boost
103
104 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, <= 1700)
105 #include <boost/type_traits/detail/is_function_msvc10_fix.hpp>
106 #endif
107
108 #endif // BOOST_TT_IS_FUNCTION_CXX_03_HPP_INCLUDED