Brian McNamara <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Mon, Sep 01, 2003 at 09:03:17AM +0800, Joel de Guzman wrote:
> > Do it the ref, tuple and variant way:  get().  But get(), as an
> > element-access interface, should return a reference, not a pointer, as
> > it does currently.
>
> Clearly I had not been paying enough attention earlier in the thread; I
> was oblivious to the fact that get() was returning a pointer and not a
> reference.  I think get() (or operator*(), or however it ends up being
> spelled) should indeed return a reference.
>
operator*() does indeed return a reference, and I agree that operator get()
should too.

Anyway, there is a pragmetic advantage in having a function return a
pointer. It allow us to mix test+access with one call, as in:

if ( T* p = opt.get() )

but this functionality can be provided but a separate methods called
get_ptr() given the expected meaning of a method named get() for
something that is a value container.

Fernando Cacciola




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to