std::allocator::deallocate - cppreference.com (original) (raw)
| | | (constexpr since C++20) | | - | ----------------------- |
Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier call to allocate() or allocate_at_least()(since C++23).
The argument n must be equal to the first argument of the call to allocate() that originally produced p, or in the range [
m,
count]
if p is obtained from a call to allocate_at_least(m) which returned {p, count}(since C++23); 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 of a constant expression, this function must deallocate storage allocated within the evaluation of the same expression. | (since C++20) |
---|
[edit] Parameters
[edit] Return value
(none)
[edit] Example
Output:
#1 S::S(42);
#2 S::S(43);
#3 S::S(44);
#4 S::S(45);
#1 S::id();
#2 S::id();
#3 S::id();
#4 S::id();
#1 S::S();
#2 S::S();
#3 S::S();
#4 S::S();
[edit] See also
| | allocates uninitialized storage (public member function) [edit] | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | allocates uninitialized storage at least as large as requested size (public member function) [edit] | | | deallocates storage using the allocator (public static member function of std::allocator_traits) [edit] |