You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Meanwhile, the return value of error_or() is specified as follows:
Returns: std::forward<G>(e) if has_value() is true, error() otherwise.
Since these functions appear to be dual in nature, it would be preferable to maintain consistent notation. Therefore, should error_or() be modified in this way?
value_or() casts its argument v using static_cast<T>(std::forward<U>(v)). Shouldn't error_or() similarly perform a static_cast<E>?
When the constructor used for conversion is marked as explicit, value_or() will successfully perform the conversion, while error_or() will result in a compilation error.
Here I referred to const & overload, but && overload has the same problem.