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
The decay function is only needed there, because try_at returns result<value const&>, and the righthand operand of operator| is not convertible to value const&.
Given that operator| is used for providing a default, and the default usually doesn't exist before it is required, most of the time you don't want to return a result<T&>, even if the source is a result<T&>.
I can suggest adding result<T> operator|(result<T&>, U) overload that matches if U is convertible to std::decay_t<T&>. Same for function overloads.
The text was updated successfully, but these errors were encountered:
Consider this: https://godbolt.org/z/qK4GTrdYM
The
decay
function is only needed there, becausetry_at
returnsresult<value const&>
, and the righthand operand ofoperator|
is not convertible tovalue const&
.Given that
operator|
is used for providing a default, and the default usually doesn't exist before it is required, most of the time you don't want to return aresult<T&>
, even if the source is aresult<T&>
.I can suggest adding
result<T> operator|(result<T&>, U)
overload that matches ifU
is convertible tostd::decay_t<T&>
. Same for function overloads.The text was updated successfully, but these errors were encountered: