"Eric Friedman" <[EMAIL PROTECTED]> wrote in message
b2s34c$bav$[EMAIL PROTECTED]">news:b2s34c$bav$[EMAIL PROTECTED]...
> Fernando Cacciola wrote:
> [snip]
> > (3) variant<> dependency.
> >
> > We are just about to review boost::variant<>.
> > I was planning to wrap optional<> around variant discarding its current
> > implementation.
>
> This might seem like a good idea in theory, but for the simple case
> presented by optional<>, the baggage of variant's implementation is
overkill
> IMO.
>
Indeed. I've been looking at the implementation and it is exactly the case.
Anyway, I see that you're progressing towards move semantics, so I will
likely find useful those utilities once you finish them (in order to
increase exception guarantess)

>
> It might be useful in the future, however, to build a tests for optional
> that compares your boost::optional<T> against a suitably-wrapped
> boost::variant<empty, T>.
>
Yes.

> > However, to support the in-place form and use variant<>, the later will
> have
> > to suppport this form itself.
> >
> > Proposed solution:
> [snip]
> > ...I figured that a factory could move the forwarding problem out of
> > optional<>
> > while at the same time allow for an almost identical usage.
>
> This seems like a good idea, particularly in terms of integrating
> factory-based initialization with variant.
>
Great.

> [snip]
> > It allows to use in-place for noncopyable default-constructible objects:
> >
> > optional<Z> opt(true,in_place());
> >
> > It allows you to have alternative factories which support alternative
> > forwarding methods:
> >
> > optional<X> opt(false,in_place2(2,"hello"));
> >
> > And since the factory can be reused, plugging the mechanism into
> variant<>,
> > for instance, is trivial.
> >
> > Notice that the verbosity is actually put in the in-place factory
mainly.
> > I would implement and document such factory as another utility and just
> > use it on optional<> interface.
>
> Let me know when you get this working for optional<>. I personally would
be
> quite interested in seeing how it might fit into variant<>. (I won't be
> making any changes, however, until after variant's review has ended.)
>
OK. I'll keep you inform.


--
Fernando Cacciola



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to