On Tue, May 6, 2008 at 6:31 PM, Igor R.
At least what I read here is following: All instances v of type varianthttp://www.boost.org/doc/libs/1_35_0/doc/html/boost/variant.html
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