"David Abrahams" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > "Fernando Cacciola" <[EMAIL PROTECTED]> writes: > > > "Peter Dimov" <[EMAIL PROTECTED]> wrote in message > > 00d901c2d820$bd2225c0$1d00a8c0@pdimov2">news:00d901c2d820$bd2225c0$1d00a8c0@pdimov2... > >> David Abrahams wrote: > >> > "Peter Dimov" <[EMAIL PROTECTED]> writes: > >> > > >> >> Joel de Guzman wrote: > >> >>> David Abrahams wrote: > >> >>> > >> >>>> BTW, I just realized that a conversion from variant<T> to > >> >>>> optional<T> could be used to do extraction as well. Maybe it > >> > >> -------------^ > >> > >> >>>> would be better to ditch extract altogether and just use optional? > >> >>> > >> >>> I think this makes sense. The disadvantage is the overhead of > >> >>> optional just to do "extract"ion. > >> >> > >> >> That means an extra copy > >> > > >> > Really? You can't convert to an optional<T&>? > >> > >> You said "optional<T>" above. > >> > >> It may be possible to use optional<T&> (is it supported?) > > > > No, it isn't. > > And I don't think it ever will. > > optional<X> intends to represent a value of type X wich is possiblly > > uninitialized. > > But you can't have X=T& since you can't have an uninitialized reference. > > Sorry, that's a broken analogy. You also can't have an uninitialized > object of non-POD class type U, but you allow optional<U>. > OK, I see the point. I was looking at the wrong level of indirection :-) optional<T&> is not a reference to an optional object, it's an optional reference to an object.
All right. Now that we've settled on the conceptual validity of optional<T&>... Can we have it? Any idea about what to do with reference to reference problem? I have to look at reference_wrapper() yet... What was the idea of: optional< exactly<T&> > ? -- Fernando Cacciola _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost