Closed grisumbras closed 2 years ago
BTW, while we are there, having nested type aliases for value type and error type can also be useful.
It turned out that static functions don't work when the value type is noncopyable, so I've added in_place_value
and in_place_error
static members to result
instead. This allows R( R::in_place_value, args... )
and R( R::in_place_error, args... )
.
The constructors that use special tag types from namespace
boost::system
has the unfortunate effect that one can't write a function template that (reliably) creates a result object without including some Boost.System headers. Thus it creates a physical dependency on System. For example, see this: https://godbolt.org/z/7KsKfreKe.This can be solved with a pair of static functions
result::make_error
andresult::make_value
.