----- Original Message ----- From: "Fernando Cacciola" <[EMAIL PROTECTED]>
> > > optional captures the zero/one distinction, which, as its analogy to > > > pointers makes clear, is a very useful one. A type which can contain > > > any number of different types would have a much more complicated > > > interface. Maybe it's just a different library? > > > > Or perhaps, optional is just a limited add-on API over the variant? > > The low-level implementation mechanism in place seems to be very > > similar and having 2 separate libraries will be redundant, I think. > > > Not so... > The low-level implementation is like a variant ONLY is the wrapped object is > not a POD. > When you have, say, optional<int>, the implementation uses: struct { int > m_value ; bool m_initialized } > As a result, value access, via operator*() is more efficient since it > doesn't dereference a pointer. That depends on how the variant is implemented. Which variant implementation are you referring to? I'm sorry. I'm confused with what you are saying. I can't see why it is more efficient. Neither do I see a dereference in any case. Joel de Guzman [EMAIL PROTECTED] http://www.boost-consulting.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost