Boost logo

Boost :

Subject: Re: [boost] [smart_ptr] Is there any interest in unique_ptr with type erased deleter?
From: Andrey Davydov (andrey.a.davydov_at_[hidden])
Date: 2017-03-21 09:54:53


On Tue, Mar 21, 2017 at 12:00 PM, Richard Hodges <hodges.r_at_[hidden]> wrote:

> What is required, more than simply creating a type-erased deleter?

Also deleter must capture pointer, because pointer which was passed to
constructor can differ from the pointer which will be deleted. For example,

struct Base { /* ... */ };
struct Derived : Base { /* ... */ };

ptr<Derived> p1(new Derived);
void * raw_p1 = p1.get();
ptr<Base> p2 = std::move(p1);
void * raw_p2 = p2.get();
assert(raw_p1 != raw_p2);

> Isn’t this simply a partial specialisation of std::unique_ptr?

 It seems to me that to declare specialization of std::unique_ptr is
undefined behavior.

-- 
Andrey Davydov.

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