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
To me the biggest use of optional<T&> is in arguments like void foo(optional<const Heavy&>) where the naive void foo1(const optional<Heavy>&) of course means foo1(heavy) has to copy the heavy to a optional<Heavy>. Of course, if I have an optional<Heavy> optHeavy I can call foo1(optHeavy), but if I call foo(optHeavy), tl::optional won't implicitly convert from const optional<Heavy> to optional<const Heavy&>.
That is, I'd like optional<T&> to be constructible from optional<T>. That would let foo(optHeavy) Just Work. (Or maybe just let optional<const T&> construct from const optional<T>&?)
The text was updated successfully, but these errors were encountered:
To me the biggest use of
optional<T&>
is in arguments likevoid foo(optional<const Heavy&>)
where the naivevoid foo1(const optional<Heavy>&)
of course meansfoo1(heavy)
has to copy theheavy
to aoptional<Heavy>
. Of course, if I have anoptional<Heavy> optHeavy
I can callfoo1(optHeavy)
, but if I callfoo(optHeavy)
,tl::optional
won't implicitly convert fromconst optional<Heavy>
tooptional<const Heavy&>
.That is, I'd like
optional<T&>
to be constructible fromoptional<T>
. That would letfoo(optHeavy)
Just Work. (Or maybe just letoptional<const T&>
construct fromconst optional<T>&
?)The text was updated successfully, but these errors were encountered: