Add enable_if guards for forwarding constructors.
This commit is contained in:
parent
05b59cc63b
commit
b5060687cc
@ -135,7 +135,7 @@ class LambdaPromise : public PromiseInterface<ValueT> {
|
|||||||
, on_fail_(use_ok_as_fail ? OnFail::Ok : OnFail::Fail)
|
, on_fail_(use_ok_as_fail ? OnFail::Ok : OnFail::Fail)
|
||||||
, has_lambda_(true) {
|
, has_lambda_(true) {
|
||||||
}
|
}
|
||||||
template <class FromOkT>
|
template <class FromOkT, std::enable_if_t<!std::is_same<std::decay_t<FromOkT>, LambdaPromise>::value, int> = 0>
|
||||||
LambdaPromise(FromOkT &&ok) : LambdaPromise(std::forward<FromOkT>(ok), Ignore(), true) {
|
LambdaPromise(FromOkT &&ok) : LambdaPromise(std::forward<FromOkT>(ok), Ignore(), true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ class Promise {
|
|||||||
}
|
}
|
||||||
Promise(SafePromise<T> &&other);
|
Promise(SafePromise<T> &&other);
|
||||||
Promise &operator=(SafePromise<T> &&other);
|
Promise &operator=(SafePromise<T> &&other);
|
||||||
template <class F>
|
template <class F, std::enable_if_t<!std::is_same<std::decay_t<F>, Promise>::value, int> = 0>
|
||||||
Promise(F &&f) : promise_(promise_interface_ptr<T>(std::forward<F>(f))) {
|
Promise(F &&f) : promise_(promise_interface_ptr<T>(std::forward<F>(f))) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class LambdaEvent final : public CustomEvent {
|
|||||||
LOG(FATAL) << "Not supported";
|
LOG(FATAL) << "Not supported";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
template <class FromLambdaT>
|
template <class FromLambdaT, std::enable_if_t<!std::is_same<std::decay_t<FromLambdaT>, LambdaEvent>::value, int> = 0>
|
||||||
explicit LambdaEvent(FromLambdaT &&lambda) : f_(std::forward<FromLambdaT>(lambda)) {
|
explicit LambdaEvent(FromLambdaT &&lambda) : f_(std::forward<FromLambdaT>(lambda)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,9 @@ class optional {
|
|||||||
}
|
}
|
||||||
|
|
||||||
optional &operator=(const optional &other) {
|
optional &operator=(const optional &other) {
|
||||||
|
if (this == &other) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
if (other) {
|
if (other) {
|
||||||
impl_ = Result<T>(other.value());
|
impl_ = Result<T>(other.value());
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user