Boost logo

Boost :

From: Tanton Gibbs (thgibbs_at_[hidden])
Date: 2002-12-10 20:10:46


> > > That's why it hands you a pointer to the value, because you can test
the
> > > pointer
> > > for NULL; but that's it.
> > > IOWs, the pointer returned by optional is conceptually a handle, not a
> > > pointer.
> > > That's why I like the member function peek() much better than get().
> >
> > I still much prefer the standard get(), even if I bought into the rest
of
> > the rationale. It's what people expect because of std::auto_ptr.
> >
> I see.
> I counted 2(two) in favor of get(), and one (me :-) in favor of peek().
> I'll be democratic on this one, though I hope I can get more counts.

For what its worth, I vote in favor of value semantics. It seems much
easier
to me to remember to call initialized when I want to test validity than it
does
to remember which of *, peek, get, get_value to use in which case. Also,
the fact that I can assign a non pointer value to a smart-pointer is kinda
strange.
To me, it just doesn't fit the smart pointer mold and the interface is
confusing
because it is trying to shape an elephant into a rhino -- yeah, their close,
but
shaping a hippo to a rhino might be easier. Therefore, I urge you to
reconsider
value semantics as I think those examples were much cleaner and clearer than
the examples I have been seeing.

Thanks,
Tanton


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