2 // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BEAST_DETAIL_IS_CALL_POSSIBLE_HPP
9 #define BEAST_DETAIL_IS_CALL_POSSIBLE_HPP
11 #include <type_traits>
16 template<class R, class C, class ...A>
18 is_call_possible_test(C&& c, int, A&& ...a)
19 -> decltype(std::is_convertible<
20 decltype(c(a...)), R>::value ||
21 std::is_same<R, void>::value,
24 template<class R, class C, class ...A>
26 is_call_possible_test(C&& c, long, A&& ...a);
28 /** Metafunction returns `true` if F callable as R(A...)
33 is_call_possible<T, void(std::string)>
37 template<class C, class F>
38 struct is_call_possible
43 template<class C, class R, class ...A>
44 struct is_call_possible<C, R(A...)>
45 : decltype(is_call_possible_test<R>(
46 std::declval<C>(), 1, std::declval<A>()...))