From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-08-04 19:35:30
Peter Dimov wrote:
>>> Look, if I have:
>>> variant<foo,int> a=foo(....);
>>> variant<foo,int> b=foo(....);
>>> It is my understanding that if I now do:
>>> I may end up with an int in a. Do you think that this behavior is
> My naive expectation would be for the above code to call
> foo::operator=. This would of course imply that variant::operator=
> would require the types to be assignable.
It does call operator= when both operands have the same type. Thanks.
> That aside, I think that it would be reasonable to expect the type to
> remain foo at least when foo has a nothrow default constructor.
Yes. It shouldn't add runtime overhead to try to fall back to the
original type, if possible.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk