Boost logo

Boost :

Subject: Re: [boost] Is there any interest in non-owning pointer-like types?
From: Olaf van der Spek (ml_at_[hidden])
Date: 2017-02-01 06:02:16


On Wed, Feb 1, 2017 at 11:24 AM, Oswin Krause
<Oswin.Krause_at_[hidden]> wrote:
> For me, the biggest problem of the proposal is that observer_ptr<T> is
> implicitely constructed from T&. In my code I often use:
>
> Foo a;
> Bar b(&a);//&a signals that b only references to a, but does not copy it.
>
> Now, when I write
>
> Bar b(a); //so is a now copied?
>
> While the interface is clearer in documentation, the usage is less clear!

IMO using pointers instead of references to indicate something isn't
copied is bad practice.. the language is C++, not C.

-- 
Olaf

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