Namespaces
Variants

std::pmr::polymorphic_allocator<T>:: delete_object

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
template < class U >
void delete_object ( U * p ) ;
(自 C++20 起)

销毁类型为 U 的对象并释放为其分配的存储空间。

等效于
std:: allocator_traits < polymorphic_allocator > :: destroy ( * this, p ) ;
deallocate_object ( p ) ;

目录

参数

p - 指向要销毁并释放内存的对象的指针

异常

不抛出任何异常。

注释

此函数最初为配合完全特化的分配器 std:: pmr :: polymorphic_allocator <> 使用而引入,但在任何特化场景中都可能具有实用价值。

参见

释放通过 allocate_bytes 获取的原始内存
(公开成员函数)
释放通过 allocate_object 获取的原始内存
(公开成员函数)
[static]
使用分配器释放存储空间
( std::allocator_traits<Alloc> 的公开静态成员函数)
释放内存
( std::pmr::memory_resource 的公开成员函数)