]> git.proxmox.com Git - ceph.git/blame - ceph/src/Beast/include/beast/core/detail/is_call_possible.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / Beast / include / beast / core / detail / is_call_possible.hpp
CommitLineData
7c673cae
FG
1//
2// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
3//
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)
6//
7
8#ifndef BEAST_DETAIL_IS_CALL_POSSIBLE_HPP
9#define BEAST_DETAIL_IS_CALL_POSSIBLE_HPP
10
11#include <type_traits>
12
13namespace beast {
14namespace detail {
15
16template<class R, class C, class ...A>
17auto
18is_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,
22 std::true_type());
23
24template<class R, class C, class ...A>
25std::false_type
26is_call_possible_test(C&& c, long, A&& ...a);
27
28/** Metafunction returns `true` if F callable as R(A...)
29
30 Example:
31
32 @code
33 is_call_possible<T, void(std::string)>
34 @endcode
35*/
36/** @{ */
37template<class C, class F>
38struct is_call_possible
39 : std::false_type
40{
41};
42
43template<class C, class R, class ...A>
44struct is_call_possible<C, R(A...)>
45 : decltype(is_call_possible_test<R>(
46 std::declval<C>(), 1, std::declval<A>()...))
47{
48};
49/** @} */
50
51} // detail
52} // beast
53
54#endif