2 ms·
Yes, a free or static member function that returns an Either-like object is the way to maintain strong RAII invariants while avoiding exceptions. Either, named
by gpderetta 11y ago
Yes, a free or static member function that returns an Either-like object is the way to maintain strong RAII invariants while avoiding exceptions. Either, named Result, has been proposed of the next standard.
Unfortunately C++ still doesn't have good facilities for dealing with monads (i.e. do notation) making working with Either (and futures, and optionals) quite awkward.