Boost logo

Boost :

Subject: Re: [boost] Is there any interest in non-owning pointer-like types?
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2017-02-01 05:24:16


> Can observer_ptr refer to no object? If not, why not just use T &? If
> so, why not just use optional<T>?

As far as i understood it, it is still assignable, unlike T&.

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

Now, when I write

Bar b(a); //so is a now copied?

While the interface is clearer in documentation, the usage is less


Boost list run by bdawes at, gregod at, cpdaniel at, john at