Boost logo

Boost :

From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2007-02-12 22:14:44


On 2/12/07, Jeffrey Yasskin <jyasskin_at_[hidden]> wrote:
> On 2/9/07, Felipe Magno de Almeida <felipe.m.almeida_at_[hidden]> wrote:
> > On 2/9/07, Mathias Gaunard <mathias.gaunard_at_[hidden]> wrote:
> > > Felipe Magno de Almeida wrote:
> > > > Why would it? T* and T& have very different semantics.
> > >
> > > An optional T& has closer semantics to T* than a non-optional one.
> >
> > Didn't understand what you mean. Could you rephrase?
>
> An optional<T&> has nearly the same semantics as a T*. I think the
> only thing it's missing is pointer arithmetic, and it may be a little
> more clear that optional<T&> is non-owning (though less clear that
> it's Assignable). So I'm not sure either why anyone should use
> optional<T&> instead of T*.

I would say because of the ownership, but you said yourself.

>
> --
> Namasté,
> Jeffrey Yasskin

-- 
Felipe Magno de Almeida

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