mirror of
https://github.com/Naios/continuable.git
synced 2026-02-14 22:29:48 +08:00
add functionfy helper
This commit is contained in:
parent
3333f01e33
commit
d8c024840d
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace fu
|
namespace fu
|
||||||
{
|
{
|
||||||
@ -170,6 +171,14 @@ namespace fu
|
|||||||
struct is_unwrappable
|
struct is_unwrappable
|
||||||
: decltype(detail::test_unwrappable<Function...>(0)) { };
|
: decltype(detail::test_unwrappable<Function...>(0)) { };
|
||||||
|
|
||||||
|
/// Converts any functional type in std::function.
|
||||||
|
template<typename Functional>
|
||||||
|
auto functionfy(Functional&& functional)
|
||||||
|
-> function_type_of_t<typename std::decay<Functional>::type>
|
||||||
|
{
|
||||||
|
return function_type_of_t<typename std::decay<Functional>::type>(std::forward<Functional>(functional));
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct requires_functional_constructible
|
struct requires_functional_constructible
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user