Boost logo

Boost :

Subject: Re: [boost] expected/result/etc
From: Bjorn Reese (breese_at_[hidden])
Date: 2016-02-11 18:17:46


On 02/11/2016 11:57 PM, Emil Dotchevski wrote:

> failure, and others that do not, without giving the user a choice. Even at
> the language level, consider that in C++ constructors don't give you the
> option to return an error code, the only way for them to fail is by
> throwing. Why? Because that is the correct design.

True. However, there are situations where throwing exceptions is the
wrong design, like continuations (e.g. future<T>::then) or asynchronous
return values (e.g. Boost.Asio handlers.) For both the situations a
value-or-error type, like excepted<T>, is a correct design.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk