File indexing completed on 2025-01-18 09:29:45
0001 #ifndef BOOST_CLBL_TRTS_DETAIL_FORWARD_DECLARATIONS
0002 #define BOOST_CLBL_TRTS_DETAIL_FORWARD_DECLARATIONS
0003 #include <boost/callable_traits/detail/config.hpp>
0004 #include <boost/callable_traits/detail/default_callable_traits.hpp>
0005
0006 namespace boost { namespace callable_traits { namespace detail {
0007
0008 template<typename T>
0009 struct function;
0010
0011 template<typename T>
0012 struct has_normal_call_operator
0013 {
0014 template<typename N, N Value>
0015 struct check { check(std::nullptr_t) {} };
0016
0017 template<typename U>
0018 static std::int8_t test(
0019 check<decltype(&U::operator()), &U::operator()>);
0020
0021 template<typename>
0022 static std::int16_t test(...);
0023
0024 static constexpr bool value =
0025 sizeof(test<T>(nullptr)) == sizeof(std::int8_t);
0026 };
0027
0028 struct callable_dummy {
0029 void operator()() {}
0030 };
0031
0032 template<typename T>
0033 using default_to_function_object = typename std::conditional<
0034 has_normal_call_operator<T>::value,
0035 T, callable_dummy>::type;
0036
0037 template<typename T>
0038 struct pmf;
0039
0040 template<typename T>
0041 struct pmd;
0042
0043 template<typename F, typename T = typename std::remove_reference<F>::type>
0044 using function_object_base = typename std::conditional<
0045 has_normal_call_operator<T>::value,
0046 pmf<decltype(&default_to_function_object<T>::operator())>,
0047 default_callable_traits<T>>::type;
0048
0049 template<typename T, typename Base = function_object_base<T>>
0050 struct function_object;
0051
0052 }}}
0053
0054 #endif