Remove back template lambda support in Promise.

This commit is contained in:
levlam 2022-06-28 10:32:56 +03:00
parent 32bac7bd24
commit 003fa6ffee

View File

@ -92,7 +92,7 @@ class LambdaPromise : public PromiseInterface<ValueT> {
public:
void set_value(ValueT &&value) override {
CHECK(state_.get() == State::Ready);
func_(std::move(value));
do_ok(std::move(value));
state_ = State::Complete;
}
@ -128,6 +128,14 @@ class LambdaPromise : public PromiseInterface<ValueT> {
std::enable_if_t<!is_callable<F, Result<ValueT>>::value, void> do_error(Y &&status) {
func_(Auto());
}
template <class F = FunctionT>
std::enable_if_t<is_callable<F, Result<ValueT>>::value, void> do_ok(ValueT &&value) {
func_(Result<ValueT>(std::move(value)));
}
template <class F = FunctionT>
std::enable_if_t<!is_callable<F, Result<ValueT>>::value, void> do_ok(ValueT &&value) {
func_(std::move(value));
}
};
} // namespace detail