Redigera

Dela via


<memory>

Defines a class, an operator, and several templates that help allocate and free objects.

Requirements

Header: <memory>

Namespace: std

Members

Functions

Name Description
addressof Gets the true address of an object.
align Returns a pointer to a range of a given size, based on the provided alignment and starting address.
allocate_shared Creates a shared_ptr to objects that are allocated and constructed for a given type with a specified allocator.
atomic_compare_exchange_strong
atomic_compare_exchange_weak
atomic_compare_exchange_strong_explicit
atomic_compare_exchange_weak_explicit
atomic_exchange
atomic_exchange_explicit
atomic_is_lock_free
atomic_load
atomic_load_explicit
atomic_store
atomic_store_explicit
const_pointer_cast Const cast to shared_ptr.
declare_no_pointers Informs a garbage collector that the characters starting at a specified address and falling within the indicated block size contain no traceable pointers.
declare_reachable Informs garbage collection that the indicated address is to allocated storage and is reachable.
default_delete Deletes objects allocated with operator new. Suitable for use with unique_ptr.
destroy_at Shorthand destroy method.
destroy Shorthand destroy method.
destroy_n Shorthand destroy method.
dynamic_pointer_cast Dynamic cast to shared_ptr.
get_deleter Get deleter from shared_ptr.
get_pointer_safety Returns the type of pointer safety assumed by any garbage collector.
get_temporary_buffer Allocates temporary storage for a sequence of elements that does not exceed a specified number of elements.
make_shared Creates and returns a shared_ptr that points to the allocated object constructed from zero or more arguments using the default allocator.
make_unique Creates and returns a unique_ptr that points to the allocated object constructed from zero or more arguments.
pointer_safety An enumeration of all the possible return values for get_pointer_safety.
return_temporary_buffer Deallocates the temporary memory that was allocated using the get_temporary_buffer template function.
static_pointer_cast Static cast to shared_ptr.
swap Swap two shared_ptr or weak_ptr objects.
undeclare_no_pointers Informs a garbage collector that the characters in the memory block defined by a base address pointer and block size may now contain traceable pointers.
undeclare_reachable Informs a garbage_collector that a specified memory location is not reachable.
uninitialized_copy Copies objects from a specified input range into an uninitialized destination range.
uninitialized_copy_n Creates a copy of a specified number of elements from an input iterator. The copies are put in a forward iterator.
uninitialized_default_construct Shorthand uninitialized_default_construct method.
uninitialized_default_construct_n Shorthand uninitialized_construct method.
uninitialized_fill Copies objects of a specified value into an uninitialized destination range.
uninitialized_fill_n Copies objects of a specified value into specified number of elements an uninitialized destination range.
uninitialized_move Shorthand uninitialized_move method.
uninitialized_move_n Shorthand uninitialized_move method.
uninitialized_value_construct Shorthand uninitialized_value_construct method.
uninitialized_value_construct_n Shorthand uninitialized_value_construct method.
uses_allocator_v

Operators

Name Description
operator!= Tests for inequality between allocator objects of a specified class.
operator== Tests for equality between allocator objects of a specified class.
operator>= Tests for one allocator object being greater than or equal to a second allocator object, of a specified class.
operator< Tests for one object being less than a second object of a specified class.
operator<= Tests for one object being less than or equal to a second object of a specified class.
operator> Tests for one object being greater than a second object of a specified class.
operator<< shared_ptr inserter.

Classes

Name Description
allocator The class template describes an object that manages storage allocation and freeing for arrays of objects of type Type.
allocator_traits Describes an object that determines all the information that is needed by an allocator-enabled container.
auto_ptr The class template describes an object that stores a pointer to an allocated object of type Type * that ensures the object to which it points gets deleted when its enclosing auto_ptr gets destroyed.
bad_weak_ptr Reports bad weak_ptr exception.
enabled_shared_from_this Helps generate a shared_ptr.
pointer_traits Supplies information that is needed by an object of type allocator_traits to describe an allocator with pointer type Ptr.
raw_storage_iterator An adaptor class that is provided to enable algorithms to store their results into uninitialized memory.
shared_ptr Wraps a reference-counted smart pointer around a dynamically allocated object.
unique_ptr Stores a pointer to an owned object. The pointer is owned by no other unique_ptr. The unique_ptr is destroyed when the owner is destroyed.
weak_ptr Wraps a weakly linked pointer.

Structures

Name Description
allocator_arg_t
default_delete
hash Provides overloads specialized for unique_ptr and shared_ptr.
owner_less Allows ownership-based mixed comparisons of shared and weak pointers.
uses_allocator

Specializations

Name Description
allocator<void> A specialization of the class template allocator to type void, defining only the member types that make sense in this specialized context.

See also

Header Files Reference
Thread Safety in the C++ Standard Library