if (contains_ == Contains::VALUE) {
new (&value_)T(std::move(t.value_));
} else if (contains_ == Contains::EXCEPTION) {
- new (&e_)std::unique_ptr<exception_wrapper>(std::move(t.e_));
+ new (&e_) exception_wrapper(std::move(t.e_));
}
}
new (&value_) T();
} else if (t.hasException()) {
contains_ = Contains::EXCEPTION;
- new (&e_) std::unique_ptr<exception_wrapper>(
- folly::make_unique<exception_wrapper>(t.exception()));
+ new (&e_) exception_wrapper(t.exception());
}
}
if (contains_ == Contains::VALUE) {
new (&value_)T(std::move(t.value_));
} else if (contains_ == Contains::EXCEPTION) {
- new (&e_)std::unique_ptr<exception_wrapper>(std::move(t.e_));
+ new (&e_) exception_wrapper(std::move(t.e_));
}
return *this;
}
if (contains_ == Contains::VALUE) {
new (&value_)T(t.value_);
} else if (contains_ == Contains::EXCEPTION) {
- new (&e_)std::unique_ptr<exception_wrapper>();
- e_ = folly::make_unique<exception_wrapper>(*(t.e_));
+ new (&e_) exception_wrapper(t.e_);
}
}
if (contains_ == Contains::VALUE) {
new (&value_)T(t.value_);
} else if (contains_ == Contains::EXCEPTION) {
- new (&e_)std::unique_ptr<exception_wrapper>();
- e_ = folly::make_unique<exception_wrapper>(*(t.e_));
+ new (&e_) exception_wrapper(t.e_);
}
return *this;
}
if (LIKELY(contains_ == Contains::VALUE)) {
value_.~T();
} else if (UNLIKELY(contains_ == Contains::EXCEPTION)) {
- e_.~unique_ptr<exception_wrapper>();
+ e_.~exception_wrapper();
}
}
void Try<T>::throwIfFailed() const {
if (contains_ != Contains::VALUE) {
if (contains_ == Contains::EXCEPTION) {
- e_->throw_exception();
+ e_.throw_exception();
} else {
throw UsingUninitializedTry();
}
void Try<void>::throwIfFailed() const {
if (!hasValue_) {
- e_->throw_exception();
+ e_.throw_exception();
}
}