feat update
Some checks failed
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 1m54s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 1m46s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 2m6s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 2m4s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 2m23s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 2m28s

This commit is contained in:
tqcq 2024-04-19 20:51:12 +00:00
parent 22f3189603
commit 40a8ffd402

View File

@ -3,10 +3,18 @@
#pragma once #pragma once
#include "sled/any.h" #include "sled/any.h"
#include <functional>
#include <string> #include <string>
namespace sled { namespace sled {
namespace failure { 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> template<typename FailureT>
inline FailureT inline FailureT
FailureFromString(std::string &&) FailureFromString(std::string &&)
@ -29,6 +37,14 @@ FailureFromString<std::string>(std::string &&str)
return std::move(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 failure
namespace future_detail { namespace future_detail {