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
> > > 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
> > 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
to me to remember to call initialized when I want to test validity than it
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
To me, it just doesn't fit the smart pointer mold and the interface is
because it is trying to shape an elephant into a rhino -- yeah, their close,
shaping a hippo to a rhino might be easier. Therefore, I urge you to
value semantics as I think those examples were much cleaner and clearer than
the examples I have been seeing.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk