Commit f7afb2cc authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

invoke_type members for free- and member-invoke traits containers

Summary:
[Folly] `invoke_type` members for free- and member-invoke traits containers.

Usable as:

```
FOLLY_CREATE_FREE_INVOKE_TRAITS(swap_invoke_traits, swap, std);
// ...
swap_invoke_traits::invoke_type my_swap;
my_swap(obj1, obj2);

Reviewed By: aary

Differential Revision: D8670799

fbshipit-source-id: 0c24912721aa20ca9647261e24ed3eb0e340ab20
parent 23bb52a4
...@@ -192,6 +192,8 @@ struct free_invoke_proxy { ...@@ -192,6 +192,8 @@ struct free_invoke_proxy {
-> decltype(Invoke{}(static_cast<Args&&>(args)...)) { -> decltype(Invoke{}(static_cast<Args&&>(args)...)) {
return Invoke{}(static_cast<Args&&>(args)...); return Invoke{}(static_cast<Args&&>(args)...);
} }
using invoke_type = Invoke;
}; };
} // namespace detail } // namespace detail
...@@ -214,6 +216,10 @@ struct free_invoke_proxy { ...@@ -214,6 +216,10 @@ struct free_invoke_proxy {
* *
* * invoke * * invoke
* *
* And a member type alias:
*
* * invoke_type
*
* These members have behavior matching the behavior of C++17's corresponding * These members have behavior matching the behavior of C++17's corresponding
* invocation traits types, aliases, and functions, but substituting canonical * invocation traits types, aliases, and functions, but substituting canonical
* invocation with member invocation. * invocation with member invocation.
...@@ -326,6 +332,8 @@ struct member_invoke_proxy { ...@@ -326,6 +332,8 @@ struct member_invoke_proxy {
-> decltype(Invoke{}(static_cast<O&&>(o), static_cast<Args&&>(args)...)) { -> decltype(Invoke{}(static_cast<O&&>(o), static_cast<Args&&>(args)...)) {
return Invoke{}(static_cast<O&&>(o), static_cast<Args&&>(args)...); return Invoke{}(static_cast<O&&>(o), static_cast<Args&&>(args)...);
} }
using invoke_type = Invoke;
}; };
} // namespace detail } // namespace detail
...@@ -348,6 +356,10 @@ struct member_invoke_proxy { ...@@ -348,6 +356,10 @@ struct member_invoke_proxy {
* *
* * invoke * * invoke
* *
* And a member type alias:
*
* * invoke_type
*
* These members have behavior matching the behavior of C++17's corresponding * These members have behavior matching the behavior of C++17's corresponding
* invocation traits types, aliases, and functions, but substituting canonical * invocation traits types, aliases, and functions, but substituting canonical
* invocation with member invocation. * invocation with member invocation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment