File indexing completed on 2025-01-18 09:29:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_BEAST_DETAIL_IS_INVOCABLE_HPP
0011 #define BOOST_BEAST_DETAIL_IS_INVOCABLE_HPP
0012
0013 #include <boost/asio/async_result.hpp>
0014 #include <boost/type_traits/make_void.hpp>
0015 #include <type_traits>
0016 #include <utility>
0017
0018 namespace boost {
0019 namespace beast {
0020 namespace detail {
0021
0022 template<class R, class C, class ...A>
0023 auto
0024 is_invocable_test(C&& c, int, A&& ...a)
0025 -> decltype(std::is_convertible<
0026 decltype(c(std::forward<A>(a)...)), R>::value ||
0027 std::is_same<R, void>::value,
0028 std::true_type());
0029
0030 template<class R, class C, class ...A>
0031 std::false_type
0032 is_invocable_test(C&& c, long, A&& ...a);
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 template<class C, class F>
0044 struct is_invocable : std::false_type
0045 {
0046 };
0047
0048 template<class C, class R, class ...A>
0049 struct is_invocable<C, R(A...)>
0050 : decltype(is_invocable_test<R>(
0051 std::declval<C>(), 1, std::declval<A>()...))
0052 {
0053 };
0054
0055
0056 template<class CompletionToken, class Signature, class = void>
0057 struct is_completion_token_for : std::false_type
0058 {
0059 };
0060
0061 struct any_initiation
0062 {
0063 template<class...AnyArgs>
0064 void operator()(AnyArgs&&...);
0065 };
0066
0067 template<class CompletionToken, class R, class...Args>
0068 struct is_completion_token_for<
0069 CompletionToken, R(Args...), boost::void_t<decltype(
0070 boost::asio::async_initiate<CompletionToken, R(Args...)>(
0071 any_initiation(), std::declval<CompletionToken&>())
0072 )>> : std::true_type
0073 {
0074 };
0075
0076 }
0077 }
0078 }
0079
0080 #endif