
11 Jan
2013
11 Jan
'13
3:19 p.m.
Larry Evans wrote:
Thanks for the clarification.
However, that seems to involve a lot of checking because you'd have to check possibly all the bounded types to find one that is nothrow-default-constructible.
That's already what the copy constructor does. See the documentation on the never-emtpy guarantee.
Wouldn't it be simpler to define variant to have, implicitly, a nothrow-default-constructible type...
There's already such a type, boost::blank, but you need to include it explicitly in the list of possible types. If it's present, variant will use it to signify an empty variant. This is also explained on the aforementioned page.