Boost logo

Boost :

From: Emil Dotchevski (emil_at_[hidden])
Date: 2008-08-04 18:45:48


On Mon, Aug 4, 2008 at 2:57 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> Emil Dotchevski wrote:
>>
>> This still doesn't mean that it is desirable for operator= to be
>> allowed to change the type of the stored object.
>
> In other words, you /are/ advocating the strong guarantee.
>
>> If you list boost::blank as a valid variant, then there's nothing
>> unusual about this state. The difference in meaning is subtle but
>> nevertheless important: it's similar to a pointer that may legally be
>> null, requiring the user to deal with this possibility, vs. a pointer
>> which can never be null, allowing the user to assert when it is.
>
> I don't follow. IMO, unless you are making the exact variant type
> part of your class' public interface, it is irrelevant how you represent
> an empty variant. The only difference with adding boost::blank vs.
> creating some empty state, is that the presence of the empty state is
> explicit.

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?

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk