feat set default value
Some checks failed
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 1m27s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 2m2s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 2m6s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 2m3s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 1m59s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 2m8s

This commit is contained in:
tqcq 2024-04-19 03:38:57 +00:00
parent 2268a7e4aa
commit bfa136e8d0
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
#ifndef SLED_FUTURES_FUTURE_H #ifndef SLED_FUTURES_FUTURE_H
#define SLED_FUTURES_FUTURE_H #define SLED_FUTURES_FUTURE_H
#include <exception>
#pragma once #pragma once
#include "sled/exec/detail/invoke_result.h" #include "sled/exec/detail/invoke_result.h"
#include "sled/futures/internal/failure_handling.h" #include "sled/futures/internal/failure_handling.h"
@ -59,7 +60,7 @@ struct FutureData {
// //
template<typename T, typename FailureT> template<typename T, typename FailureT = std::exception>
class Future { class Future {
static_assert(!std::is_same<T, void>::value, "Future<void, _> is not allowed. Use Future<bool, _> instead"); static_assert(!std::is_same<T, void>::value, "Future<void, _> is not allowed. Use Future<bool, _> instead");
static_assert(!std::is_same<FailureT, void>::value, "Future<_, void> is not allowed. Use Future<_, bool> instead"); static_assert(!std::is_same<FailureT, void>::value, "Future<_, void> is not allowed. Use Future<_, bool> instead");

View File

@ -10,8 +10,8 @@ namespace sled {
template<typename T, typename FailureT> template<typename T, typename FailureT>
class Future; class Future;
template<typename T, typename FailureT> template<typename T, typename FailureT = std::exception>
class Promise { class Promise final {
static_assert(!std::is_same<T, void>::value, "Promise<void, _> is not allowed. Use Promise<bool, _> instead"); static_assert(!std::is_same<T, void>::value, "Promise<void, _> is not allowed. Use Promise<bool, _> instead");
static_assert(!std::is_same<FailureT, void>::value, static_assert(!std::is_same<FailureT, void>::value,
"Promise<_, void> is not allowed. Use Promise<_, bool> instead"); "Promise<_, void> is not allowed. Use Promise<_, bool> instead");