Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/experimental/polymorphic allocator/deallocate"

From cppreference.com
(+)
 
m (fmt, {{c}}, .)
Line 2: Line 2:
 
{{cpp/experimental/lib extensions/pmr/polymorphic_allocator/navbar}}
 
{{cpp/experimental/lib extensions/pmr/polymorphic_allocator/navbar}}
  
{{ddcl | since=libfund_ts |  
+
{{ddcl|since=libfund_ts|  
void deallocate(T* p, std::size_t n );
+
void deallocate( T* p, std::size_t n );
 
}}
 
}}
  
Deallocates the storage pointed to by {{tt|p}}, which must have been allocated from a {{ltt|cpp/experimental/memory_resource}} {{tt|x}} that compares equal to {{tt|*resource()}} using {{tt|x.allocate(n * sizeof(T), alignof(T))}}.
+
Deallocates the storage pointed to by {{|p}}, which must have been allocated from a {{ltt|cpp/experimental/memory_resource}} {{tt|x}} that compares equal to {{tt|*resource()}} using {{tt|x.allocate(n * sizeof(T), alignof(T))}}.
  
Equivalent to {{tt|this->resource()->deallocate(p, n * sizeof(T), alignof(T));}}
+
Equivalent to {{tt|this->resource()->deallocate(p, n * sizeof(T), alignof(T));}}
  
 
===Parameters===
 
===Parameters===
 
{{par begin}}
 
{{par begin}}
{{par | p | pointer to memory to deallocate }}
+
{{par|p|pointer to memory to deallocate}}
{{par | n | the number of objects originally allocated }}
+
{{par|n|the number of objects originally allocated}}
 
{{par end}}
 
{{par end}}
  
Line 21: Line 21:
 
===See also===
 
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/memory/allocator traits/dsc deallocate}}
+
{{dsc inc|cpp/memory/allocator traits/dsc deallocate}}
{{dsc inc | cpp/experimental/memory resource/dsc deallocate}}
+
{{dsc inc|cpp/experimental/memory resource/dsc deallocate}}
 
{{dsc end}}
 
{{dsc end}}

Revision as of 00:15, 19 July 2023

 
 
 
 
 
void deallocate( T* p, std::size_t n );
(library fundamentals TS)

Deallocates the storage pointed to by p, which must have been allocated from a memory_resource x that compares equal to *resource() using x.allocate(n * sizeof(T), alignof(T)).

Equivalent to this->resource()->deallocate(p, n * sizeof(T), alignof(T));.

Parameters

p - pointer to memory to deallocate
n - the number of objects originally allocated

Exceptions

Throws nothing.

See also

[static]
deallocates storage using the allocator
(public static member function of std::allocator_traits<Alloc>) [edit]
deallocates memory
(public member function of std::experimental::pmr::memory_resource) [edit]