mirror of
https://github.com/Naios/continuable.git
synced 2025-12-09 18:26:46 +08:00
add functionfy helper
This commit is contained in:
parent
3333f01e33
commit
d8c024840d
@ -26,6 +26,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace fu
|
||||
{
|
||||
@ -170,6 +171,14 @@ namespace fu
|
||||
struct is_unwrappable
|
||||
: 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>
|
||||
struct requires_functional_constructible
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user