20 #include <type_traits> 36 #if __cpp_lib_invoke >= 201411 || _MSC_VER 48 template <
typename F,
typename...
Args>
51 -> decltype(static_cast<F&&>(
f)(static_cast<
Args&&>(args)...)) {
52 return static_cast<F&&
>(
f)(static_cast<Args&&>(args)...);
54 template <
typename M,
typename C,
typename...
Args>
56 -> decltype(std::mem_fn(d)(static_cast<Args&&>(args)...)) {
57 return std::mem_fn(d)(
static_cast<Args&&
>(args)...);
65 #if __cpp_lib_is_invocable >= 201703 || \ 66 (_MSC_VER >= 1911 && _MSVC_LANG > 201402) 70 using std::invoke_result;
72 using std::is_invocable;
73 using std::is_invocable_r;
74 using std::is_nothrow_invocable;
75 using std::is_nothrow_invocable_r;
83 namespace invoke_detail {
85 template <
typename F,
typename...
Args>
87 decltype(
invoke(std::declval<F>(), std::declval<Args>()...));
89 template <
typename F,
typename...
Args>
92 invoke(std::declval<F>(), std::declval<Args>()...))> {};
96 template <
typename Void,
typename F,
typename...
Args>
99 template <
typename F,
typename...
Args>
104 template <
typename Void,
typename F,
typename...
Args>
107 template <
typename F,
typename...
Args>
111 template <
typename Void,
typename R,
typename F,
typename... Args>
114 template <
typename R,
typename F,
typename... Args>
116 : std::is_convertible<invoke_result_<F, Args...>, R> {};
118 template <
typename Void,
typename F,
typename... Args>
121 template <
typename F,
typename... Args>
125 template <
typename Void,
typename R,
typename F,
typename... Args>
128 template <
typename R,
typename F,
typename... Args>
131 std::is_convertible<invoke_result_<F, Args...>, R>,
132 invoke_nothrow_<F, Args...>> {};
137 template <
typename F,
typename...
Args>
141 template <
typename F,
typename...
Args>
145 template <
typename F,
typename...
Args>
149 template <
typename R,
typename F,
typename...
Args>
153 template <
typename F,
typename...
Args>
158 template <
typename R,
typename F,
typename...
Args>
169 struct invoke_private_overload;
171 template <
typename Invoke>
174 template <
typename...
Args>
176 template <
typename...
Args>
178 template <
typename...
Args>
180 template <
typename R,
typename...
Args>
182 template <
typename...
Args>
184 template <
typename R,
typename...
Args>
188 template <
typename...
Args>
192 return Invoke{}(
static_cast<Args&&
>(args)...);
283 #define FOLLY_CREATE_FREE_INVOKE_TRAITS(classname, funcname, ...) \ 284 namespace classname##__folly_detail_invoke_ns { \ 285 namespace classname##__folly_detail_invoke_ns_inline { \ 287 FOLLY_CLANG_DISABLE_WARNING("-Wunused-function") \ 288 void funcname(::folly::detail::invoke_private_overload&); \ 291 using FB_ARG_2_OR_1( \ 292 classname##__folly_detail_invoke_ns_inline \ 293 FOLLY_PP_DETAIL_APPEND_VA_ARG(__VA_ARGS__))::funcname; \ 294 struct classname##__folly_detail_invoke { \ 295 template <typename... Args> \ 296 constexpr auto operator()(Args&&... args) const \ 297 noexcept(noexcept(funcname(static_cast<Args&&>(args)...))) \ 298 -> decltype(funcname(static_cast<Args&&>(args)...)) { \ 299 return funcname(static_cast<Args&&>(args)...); \ 303 struct classname : ::folly::detail::free_invoke_proxy< \ 304 classname##__folly_detail_invoke_ns:: \ 305 classname##__folly_detail_invoke> {} 310 template <
typename Invoke>
313 template <
typename O,
typename...
Args>
315 template <
typename O,
typename...
Args>
317 template <
typename O,
typename...
Args>
319 template <
typename R,
typename O,
typename...
Args>
321 template <
typename O,
typename...
Args>
324 template <
typename R,
typename O,
typename...
Args>
328 template <
typename O,
typename...
Args>
330 noexcept(Invoke{}(
static_cast<O&&
>(o), static_cast<Args&&>(args)...)))
331 -> decltype(
Invoke{}(
static_cast<O&&
>(o), static_cast<Args&&>(args)...)) {
332 return Invoke{}(
static_cast<O&&
>(o), static_cast<Args&&>(args)...);
402 #define FOLLY_CREATE_MEMBER_INVOKE_TRAITS(classname, membername) \ 403 struct classname##__folly_detail_member_invoke { \ 404 template <typename O, typename... Args> \ 405 constexpr auto operator()(O&& o, Args&&... args) const noexcept(noexcept( \ 406 static_cast<O&&>(o).membername(static_cast<Args&&>(args)...))) \ 408 static_cast<O&&>(o).membername(static_cast<Args&&>(args)...)) { \ 409 return static_cast<O&&>(o).membername(static_cast<Args&&>(args)...); \ 412 struct classname : ::folly::detail::member_invoke_proxy< \ 413 classname##__folly_detail_member_invoke> {}
typename invoke_result< F, Args... >::type invoke_result_t
constexpr auto invoke(M(C::*d), Args &&...args) -> decltype(std::mem_fn(d)(static_cast< Args && >(args)...))
folly::invoke_result_t< Invoke, O, Args... > invoke_result_t
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
—— Concurrent Priority Queue Implementation ——
requires E e noexcept(noexcept(s.error(std::move(e))))
bool_constant< true > true_type
constexpr auto invoke(F &&f, Args &&...args) noexcept(noexcept(static_cast< F && >(f)(static_cast< Args && >(args)...))) -> decltype(static_cast< F && >(f)(static_cast< Args && >(args)...))
std::integral_constant< bool, B > bool_constant
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
decltype(invoke(std::declval< F >(), std::declval< Args >()...)) invoke_result_
type_t< void, Ts... > void_t
static constexpr auto invoke(O &&o, Args &&...args) noexcept(noexcept(Invoke{}(static_cast< O && >(o), static_cast< Args && >(args)...))) -> decltype(Invoke
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
bool_constant< false > false_type
static constexpr auto invoke(Args &&...args) noexcept(noexcept(Invoke{}(static_cast< Args && >(args)...))) -> decltype(Invoke
folly::invoke_result_t< Invoke, Args... > invoke_result_t
invoke_result_< F, Args... > type