Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2008-05-06 13:45:25


On Tue, May 6, 2008 at 6:31 PM, Igor R. <igor_rubinov_at_[hidden]> wrote:

>
> > At least what I read here is following:
> > All instances v of type variant<http://www.boost.org/doc/libs/1_35_0/doc/html/boost/variant.html>
> <T1,T2,...,TN> guarantee that v has constructed content of !!!one!!! of
> the types !!!T*i!!!*, even if an operation on v has previously failed.
> > For me it means that it can be T2 or TN as well.
>
> Right, but the 1st link says:
> "*boost::variant*<http://www.boost.org/doc/libs/1_35_0/doc/html/boost/variant.html><
> int, std::string > v;
> By default, a variant default-constructs its first bounded type, so vinitially contains
> int(0). If this is not desired, or if the first bounded type is not
> default-constructible, a variant can be constructed directly from any
> value convertible to one of its bounded types. "
>
> Igor, I assume the following:
If the first type throws an exception while creation the second is created
and so forth and the exception is probably not reported to you. Your pointer
can be NULL in your previous example. Why don't you like visitor to dispatch
the type stored in the variant?

Regards,
Ovanes



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net