Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-12-11 08:21:40


From: "Fernando Cacciola" <fernando_cacciola_at_[hidden]>
> I still don't like to think of optional<> as a container, so I still don't
> like this reset.

I don't see why. reset() has nothing to do with containership; it's a
generic shorthand for reconstructing an object in place.

void X::reset(args)

Effects: destroys the contents of *this (if any)
Postconditions: *this is equivalent to X(args)

> Currently, you can change the value of the optional directly without any
> performance
> penalty like this: *opt = new_val, so I don't see any real need for
reset().

Not correct, *opt has undefined behavior when opt is uninitialized.


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