Boost logo

Boost :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2005-10-18 14:22:23

Fernando Cacciola wrote:
> Joel de Guzman wrote:
>>no assigment from T and the reset(), reset(nil), reset(T)
> Well, I'm not so sure about reset().
> My very first boost submision had reset() and no assignment from T, exactly
> as we are considering now. But the big problem, and it was big, was that it
> just made people be even more confused about optional<> being yet another
> smart pointer (precisey becasue auto_ptr and shared_ptr uses it).
> AFAICT, the choice between:
> o = make_optional(val);
> o = nullptr ;
> and
> o.reset(val);
> o.reset();
> is just cosmetical.. and at that, I prefer the first version because it
> pushes optional<> away from a smart_ptr.
> IOW, that it uses * and -> just like any other nullable type makes sense
> because the semantics of these operators are the same for all nullable
> types; but the semantics of reset() in the case of optional<> are different
> from those of a smart ptr (deep vs shallow).

Then perhaps you should consider the other examples of similar semantics
in the STL. Specifically the clear() and assign() interface of
containers. I.e.:


That looks obviously not pointer like to me. And clear enough as to the
meaning. But of course it brings to mind the idea that it's just a
single value container, and hence possibly should have some more of
those interfaces.

Just a thought :-)

-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. -
-- rrivera/ - grafik/
-- 102708583/icq - grafikrobot/aim - Grafik/

Boost list run by bdawes at, gregod at, cpdaniel at, john at