Fix __::shared_pointer deleter on bad_alloc

This commit is contained in:
Steven Dee (Jōshin) 2024-08-28 09:44:26 -07:00
parent d9b35fab19
commit 38f0504429
No known key found for this signature in database

View file

@ -90,15 +90,14 @@ template<typename T, typename D>
class shared_pointer : public shared_ref class shared_pointer : public shared_ref
{ {
public: public:
static shared_pointer* make(T* const p, auto&& d) static shared_pointer* make(T* const p, D d)
{ {
auto p2 = unique_ptr(p); auto p2 = unique_ptr<T, D>(p, move(d));
return new shared_pointer(p2.release(), forward<decltype(d)>(d)); return new shared_pointer(p2.release(), move(p2.get_deleter()));
} }
private: private:
shared_pointer(T* const p, auto&& d) noexcept shared_pointer(T* const p, D d) noexcept : p(p), d(move(d))
: p(p), d(forward<decltype(d)>(d))
{ {
} }