17 Jan
2017
17 Jan
'17
4:24 p.m.
Hi,
If yes, there comes another question. One of the main reasons exceptions were introduced in the first place was to be able to report failures from functions that cannot use the return value for this purpose: constructors, conversion operators, and other operators. How do you deal with these functions in the sea of noexcept?
I would argue that failing to create an object is breaking so many invariants that this awards an exception. On the other hand, we do have an example of objects which can be constructed in a failed state, e.g. std::ifstream which then come with their own error reporting mechanism. Best, Oswin