
21 Mar
2017
21 Mar
'17
9:54 a.m.
On Tue, Mar 21, 2017 at 12:00 PM, Richard Hodges
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.