// // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Official repository: https://github.com/boostorg/beast // #ifndef BOOST_BEAST_DETAIL_IS_INVOCABLE_HPP #define BOOST_BEAST_DETAIL_IS_INVOCABLE_HPP #include #include namespace boost { namespace beast { namespace detail { template auto is_invocable_test(C&& c, int, A&& ...a) -> decltype(std::is_convertible< decltype(c(std::forward(a)...)), R>::value || std::is_same::value, std::true_type()); template std::false_type is_invocable_test(C&& c, long, A&& ...a); /** Metafunction returns `true` if F callable as R(A...) Example: @code is_invocable::value @endcode */ /** @{ */ template struct is_invocable : std::false_type { }; template struct is_invocable : decltype(is_invocable_test( std::declval(), 1, std::declval()...)) { }; /** @} */ } // detail } // beast } // boost #endif