add functionfy helper

This commit is contained in:
Naios 2015-06-19 18:33:35 +02:00
parent 3333f01e33
commit d8c024840d

View File

@ -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
{