nonstd::expected is sometimes cumbersome to use. Whenever you require it to has value, certain boilerplate is involved. But why not replace it with a specific type of assert that aborts the program if the variable has unexpected value.
Should work for any printable unexpected type.
Example:
auto result = something_returning_expected().get_value_or_abort();
nonstd::expected
is sometimes cumbersome to use. Whenever you require it to has value, certain boilerplate is involved. But why not replace it with a specific type of assert that aborts the program if the variable has unexpected value.Should work for any printable unexpected type.
Example: