]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/callable_traits/is_invocable.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / callable_traits / is_invocable.hpp
CommitLineData
b32b8144
FG
1/*
2
3@Copyright Barrett Adair 2015-2017
4Distributed under the Boost Software License, Version 1.0.
5(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
6
7*/
8
9#ifndef BOOST_CLBL_TRTS_IS_INVOCABLE_HPP
10#define BOOST_CLBL_TRTS_IS_INVOCABLE_HPP
11
12#include <boost/callable_traits/detail/core.hpp>
13#include <boost/callable_traits/detail/is_invocable_impl.hpp>
14
15namespace boost { namespace callable_traits {
16
17//[ is_invocable_hpp
18/*`[section:ref_is_invocable is_invocable]
19[heading Header]
20``#include <boost/callable_traits/is_invocable.hpp>``
21[heading Definition]
22*/
23
24// inherits from either std::true_type or std::false_type
25template<typename T, typename... Args>
26struct is_invocable;
27
28// inherits from either std::true_type or std::false_type
29template<typename Ret, typename T, typename... Args>
30struct is_invocable_r;
31
32//<-
33template<typename T, typename... Args>
34struct is_invocable : detail::is_invocable_impl<T, Args...>::type {
35 using type = typename detail::is_invocable_impl<T, Args...>::type;
36};
37
38template<typename Ret, typename T, typename... Args>
39struct is_invocable_r
40 : detail::is_invocable_r_impl<
41 typename detail::is_invocable_impl<T, Args...>::type, Ret, T, Args...>::type
42{
43 using type = typename detail::is_invocable_r_impl<
44 typename detail::is_invocable_impl<T, Args...>::type, Ret, T, Args...>::type;
45};
46
47#ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
48
49template<typename T, typename... Args>
50struct is_invocable_v {
51 static_assert(std::is_same<T, detail::dummy>::value,
52 "Variable templates not supported on this compiler.");
53};
54
55template<typename Ret, typename T, typename... Args>
56struct is_invocable_r_v {
57 static_assert(std::is_same<T, detail::dummy>::value,
58 "Variable templates not supported on this compiler.");
59};
60
61#else
62//->
63// only available when variable templates are supported
64template<typename T, typename... Args>
65//<-
66BOOST_CLBL_TRAITS_INLINE_VAR
67//->
68constexpr bool is_invocable_v = //see below
69//<-
20effc67 70 detail::is_invocable_impl<T, Args...>::type::value;
b32b8144
FG
71//->
72
73// only available when variable templates are supported
74template<typename Ret, typename T, typename... Args>
75//<-
76BOOST_CLBL_TRAITS_INLINE_VAR
77//->
78constexpr bool is_invocable_r_v = //see below
79//<-
80 detail::is_invocable_r_impl<
81 typename detail::is_invocable_impl<T, Args...>::type,
82 Ret, T, Args...>::type::value;
83#endif
84
85}} // namespace boost::callable_traits
86//->
87
88/*`
89[heading Constraints]
90* none
91
92[heading Behavior]
93* standalone c++11 implementation of c++17 `std::is_invocable`, `std::is_invocable_r`
94[note ref-qualified overloads of `operator()` with different signatures are not handled correctly yet.]
95
96[heading Example Program]
97[import ../example/is_invocable.cpp]
98[is_invocable]
99[endsect]
100*/
101//]
102
103#endif // #ifndef BOOST_CLBL_TRTS_IS_INVOCABLE_HPP