Namespaces
Variants
Views
Actions

std::allocator<T>::deallocate

From cppreference.com
< cpp‎ | memory‎ | allocator
 
 
Dynamic memory management
Uninitialized storage
Garbage collection support
Miscellaneous
(C++20)
(C++11)
(C++11)
C Library
Low level memory management
 
std::allocator
Member functions
(until C++20)
allocator::deallocate
(until C++20)
(until C++20)
Non-member functions
 
void deallocate( T* p, std::size_t n );
(until C++20)
constexpr void deallocate( T* p, std::size_t n );
(since C++20)

Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier call to allocate().

The argument n must be equal to the first argument of the call to allocate() that originally produced p; otherwise, the behavior is undefined.

Calls ::operator delete(void*) or ::operator delete(void*, std::align_val_t) (since C++17), but it is unspecified when and how it is called.

In evaluation a constant expression, this function must deallocate storage allocated within the evaluation of the same expression.

(since C++20)

[edit] Parameters

p - pointer obtained from allocate()
n - number of objects earlier passed to allocate()

[edit] Return value

(none)

[edit] See also

allocates uninitialized storage
(public member function) [edit]
[static]
deallocates storage using the allocator
(public static member function of std::allocator_traits<Alloc>) [edit]