template <class T>
void Promise<T>::throwIfFulfilled() {
- if (UNLIKELY(!core_)) {
- throw NoState();
+ if (!core_) {
+ throwNoState();
}
- if (UNLIKELY(core_->ready())) {
- throw PromiseAlreadySatisfied();
+ if (core_->ready()) {
+ throwPromiseAlreadySatisfied();
}
}
template <class T>
void Promise<T>::throwIfRetrieved() {
- if (UNLIKELY(retrieved_)) {
- throw FutureAlreadyRetrieved();
+ if (retrieved_) {
+ throwFutureAlreadyRetrieved();
}
}
template <class T>
void Promise<T>::setException(std::exception_ptr const& ep) {
- try {
- std::rethrow_exception(ep);
- } catch (const std::exception& e) {
- setException(exception_wrapper(std::current_exception(), e));
- } catch (...) {
- setException(exception_wrapper(std::current_exception()));
- }
+ setException(exception_wrapper::from_exception_ptr(ep));
}
template <class T>