mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-05 17:30:27 +00:00
Fix __::shared_pointer deleter on bad_alloc
This commit is contained in:
parent
d9b35fab19
commit
38f0504429
1 changed files with 4 additions and 5 deletions
|
@ -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))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue