Commit 40a8ffd4 authored by tqcq's avatar tqcq
Browse files

feat update

parent 22f31896
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -3,10 +3,18 @@

#pragma once
#include "sled/any.h"
#include <functional>
#include <string>

namespace sled {
namespace failure {
namespace {
template<typename F, typename... Args>
struct is_invocable : std::is_constructible<std::function<void(Args...)>,
                                            std::reference_wrapper<typename std::remove_reference<F>::type>> {};

}// namespace

template<typename FailureT>
inline FailureT
FailureFromString(std::string &&)
@@ -29,6 +37,14 @@ FailureFromString<std::string>(std::string &&str)
    return std::move(str);
}

template<typename FailureT,
         typename = typename std::enable_if<std::is_constructible<FailureT, std::string>::value>::type>
inline FailureT
FailureFromString(std::string &&str)
{
    return FailureT(std::move(str));
}

}// namespace failure

namespace future_detail {