
4 Aug
2008
4 Aug
'08
11:11 p.m.
Steven Watanabe:
Emil Dotchevski wrote:
Look, if I have:
variant<foo,int> a=foo(....); variant<foo,int> b=foo(....);
It is my understanding that if I now do:
a=b;
I may end up with an int in a. Do you think that this behavior is reasonable?
You won't just end up with an int in a. You will also end up with an exception. Yes. I think this behavior is reasonable.
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. 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.