]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/callable_traits/detail/forward_declarations.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / callable_traits / detail / forward_declarations.hpp
1 #ifndef BOOST_CLBL_TRTS_DETAIL_FORWARD_DECLARATIONS
2 #define BOOST_CLBL_TRTS_DETAIL_FORWARD_DECLARATIONS
3 #include <boost/callable_traits/detail/config.hpp>
4 #include <boost/callable_traits/detail/default_callable_traits.hpp>
5
6 namespace boost { namespace callable_traits { namespace detail {
7
8 template<typename T>
9 struct function;
10
11 template<typename T>
12 struct has_normal_call_operator
13 {
14 template<typename N, N Value>
15 struct check { check(std::nullptr_t) {} };
16
17 template<typename U>
18 static std::int8_t test(
19 check<decltype(&U::operator()), &U::operator()>);
20
21 template<typename>
22 static std::int16_t test(...);
23
24 static constexpr bool value =
25 sizeof(test<T>(nullptr)) == sizeof(std::int8_t);
26 };
27
28 struct callable_dummy {
29 void operator()() {}
30 };
31
32 template<typename T>
33 using default_to_function_object = typename std::conditional<
34 has_normal_call_operator<T>::value,
35 T, callable_dummy>::type;
36
37 template<typename T>
38 struct pmf;
39
40 template<typename T>
41 struct pmd;
42
43 template<typename F, typename T = typename std::remove_reference<F>::type>
44 using function_object_base = typename std::conditional<
45 has_normal_call_operator<T>::value,
46 pmf<decltype(&default_to_function_object<T>::operator())>,
47 default_callable_traits<T>>::type;
48
49 template<typename T, typename Base = function_object_base<T>>
50 struct function_object;
51
52 }}} // namespace boost::callable_traits::detail
53
54 #endif // #ifndef BOOST_CLBL_TRTS_DETAIL_FORWARD_DECLARATIONS