"Joel de Guzman" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Andrei Alexandrescu <[EMAIL PROTECTED]> wrote: > > > By the way, could optional<T> use variant<T, SomeInsipidType> as a backend? > > I suggested that before. Now I think that it is not practical. > It can, but it will not be optimal. > Indeed. Using variant<> as a backend would be overkill for optional<> One of the reasons is that variant<> uses the double-storage technique to achieve higher exception safety than optional<>
> I see it the other way now. I suggest that a partial specialization of > variant<T, empty> be written that takes advantage of optional<T> > in its implementation. > This sounds reasonable. > I think now that the partial specialization of variant<T, empty> will > satisfy the anti-pointer-like crowd. variant seems to have the right > interface. Perhaps we were barking up the wrong tree? > Maybe, BTW, the right variant would be variant<empty,T>, not variant<T,empty> since variant requires the first type to be default constructible. A small issue is that variant<>::get() always check and possibly throws, while optional<>::get() will use BOOST_ASSERT, so that end users can decide how to deal with uninitialized access. Fernando Cacciola _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost