From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2003-02-18 12:26:08
"Eric Friedman" <ebf_at_[hidden]> wrote in message
> Fernando Cacciola wrote:
> > (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
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>.
> > However, to support the in-place form and use variant<>, the later will
> > to suppport this form itself.
> > Proposed solution:
> > ...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.
> > 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
> > for instance, is trivial.
> > Notice that the verbosity is actually put in the in-place factory
> > 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
> 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk