Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      Memory management library

      From cppreference.com
      <cpp
       
       
      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*)
      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)
       

      Contents

      [edit]Smart pointers(since C++11)

      Smart pointers enable automatic, exception-safe, object lifetime management.

      Defined in header<memory>
      Pointer categories
      (C++11)
      smart pointer with unique object ownership semantics
      (class template)[edit]
      (C++11)
      smart pointer with shared object ownership semantics
      (class template)[edit]
      (C++11)
      weak reference to an object managed bystd::shared_ptr
      (class template)[edit]
      (deprecated in C++11)(removed in C++17)
      smart pointer with strict object ownership semantics
      (class template)[edit]
      Helper classes
      (C++11)
      provides mixed-type owner-based ordering of shared and weak pointers
      (class template)[edit]
      (C++26)
      provides owner-based hashing for shared and weak pointers
      (class)[edit]
      provides mixed-type owner-based equal comparisons of shared and weak pointers
      (class)[edit]
      allows an object to create ashared_ptr referring to itself
      (class template)[edit]
      exception thrown when accessing aweak_ptr which refers to already destroyed object
      (class)[edit]
      default deleter forunique_ptr
      (class template)[edit]
      Smart pointer adaptors(since C++23)
      (C++23)
      interoperates with foreign pointer setters and resets a smart pointer on destruction
      (class template)[edit]
      (C++23)
      creates anout_ptr_t with an associated smart pointer and resetting arguments
      (function template)[edit]
      interoperates with foreign pointer setters, obtains the initial pointer value from a smart pointer, and resets it on destruction
      (class template)[edit]
      (C++23)
      creates aninout_ptr_t with an associated smart pointer and resetting arguments
      (function template)[edit]

      [edit]Allocators

      Allocators are class templates encapsulating memory allocation strategy. This allows generic containers to decouple memory management from the data itself.

      Defined in header<memory>
      the default allocator
      (class template)[edit]
      provides information about allocator types
      (class template)[edit]
      records the address and the actual size of storage allocated byallocate_at_least
      (class template)[edit]
      a tag used to select allocator-aware constructors
      (tag)[edit]
      checks if the specified type supports uses-allocator construction
      (class template)[edit]
      prepares the argument list matching the flavor of uses-allocator construction required by the given type
      (function template)[edit]
      creates an object of the given type by means of uses-allocator construction
      (function template)[edit]
      creates an object of the given type at specified memory location by means of uses-allocator construction
      (function template)[edit]
      Defined in header<scoped_allocator>
      implements multi-level allocator for multi-level containers
      (class template)[edit]
      Defined in header<memory_resource>
      Defined in namespacestd::pmr
      an allocator that supports run-time polymorphism based on thestd::pmr::memory_resource it is constructed with
      (class template)[edit]

      [edit]Memory resources(since C++17)

      Memory resources implement memory allocation strategies that can be used bystd::pmr::polymorphic_allocator.

      Defined in header<memory_resource>
      Defined in namespacestd::pmr
      an abstract interface for classes that encapsulate memory resources
      (class)[edit]
      returns a static program-widestd::pmr::memory_resource that uses the globaloperator new andoperator delete to allocate and deallocate memory
      (function)[edit]
      returns a staticstd::pmr::memory_resource that performs no allocation
      (function)[edit]
      gets the defaultstd::pmr::memory_resource
      (function)[edit]
      sets the defaultstd::pmr::memory_resource
      (function)[edit]
      a set of constructor options for pool resources
      (class)[edit]
      a thread-safestd::pmr::memory_resource for managing allocations in pools of different block sizes
      (class)[edit]
      a thread-unsafestd::pmr::memory_resource for managing allocations in pools of different block sizes
      (class)[edit]
      a special-purposestd::pmr::memory_resource that releases the allocated memory only when the resource is destroyed
      (class)[edit]

      [edit]Uninitialized memory algorithms

      Defined in header<memory>
      copies a range of objects to an uninitialized area of memory
      (function template)[edit]
      copies a number of objects to an uninitialized area of memory
      (function template)[edit]
      copies an object to an uninitialized area of memory, defined by a range
      (function template)[edit]
      copies an object to an uninitialized area of memory, defined by a start and a count
      (function template)[edit]
      moves a range of objects to an uninitialized area of memory
      (function template)[edit]
      moves a number of objects to an uninitialized area of memory
      (function template)[edit]
      constructs objects bydefault-initialization in an uninitialized area of memory, defined by a range
      (function template)[edit]
      constructs objects bydefault-initialization in an uninitialized area of memory, defined by a start and a count
      (function template)[edit]
      constructs objects byvalue-initialization in an uninitialized area of memory, defined by a range
      (function template)[edit]
      constructs objects byvalue-initialization in an uninitialized area of memory, defined by a start and a count
      (function template)[edit]
      (C++17)
      destroys an object at a given address
      (function template)[edit]
      (C++17)
      destroys a range of objects
      (function template)[edit]
      (C++17)
      destroys a number of objects in a range
      (function template)[edit]
      creates an object at a given address
      (function template)[edit]

      [edit]Constrained uninitialized memory algorithms(since C++20)

      C++20 providesconstrained uninitialized memory algorithms that accept range arguments or iterator-sentinel pairs.

      Defined in header<memory>
      Defined in namespacestd::ranges
      specifies some operations on iterators, sentinels and ranges are non-throwing
      (exposition-only concept*)
      copies a range of objects to an uninitialized area of memory
      (algorithm function object)[edit]
      copies a number of objects to an uninitialized area of memory
      (algorithm function object)[edit]
      copies an object to an uninitialized area of memory, defined by a range
      (algorithm function object)[edit]
      copies an object to an uninitialized area of memory, defined by a start and a count
      (algorithm function object)[edit]
      moves a range of objects to an uninitialized area of memory
      (algorithm function object)[edit]
      moves a number of objects to an uninitialized area of memory
      (algorithm function object)[edit]
      constructs objects bydefault-initialization in an uninitialized area of memory, defined by a range
      (algorithm function object)[edit]
      constructs objects bydefault-initialization in an uninitialized area of memory, defined by a start and count
      (algorithm function object)[edit]
      constructs objects byvalue-initialization in an uninitialized area of memory, defined by a range
      (algorithm function object)[edit]
      constructs objects byvalue-initialization in an uninitialized area of memory, defined by a start and a count
      (algorithm function object)[edit]
      destroys an object at a given address
      (algorithm function object)[edit]
      destroys a range of objects
      (algorithm function object)[edit]
      destroys a number of objects in a range
      (algorithm function object)[edit]
      creates an object at a given address
      (algorithm function object)[edit]

      [edit]Explicit lifetime management(since C++23)

      Defined in header<memory>
      implicitly creates objects in given storage with the object representation reused
      (function template)[edit]

      [edit]Types for composite class design(since C++26)

      Defined in header<memory>
      (C++26)
      a wrapper containing dynamically-allocated object with value-like semantics
      (class template)[edit]
      a polymorphic wrapper containing dynamically-allocated object with value-like semantics
      (class template)[edit]

      [edit]Miscellaneous

      Defined in header<memory>
      provides information about pointer-like types
      (class template)[edit]
      (C++20)
      obtains a raw pointer from a pointer-like type
      (function template)[edit]
      (C++11)
      obtains actual address of an object, even if the& operator is overloaded
      (function template)[edit]
      (C++11)
      aligns a pointer in a buffer
      (function)[edit]
      informs the compiler that a pointer is aligned
      (function template)[edit]
      checks whether the pointer points to an object whose alignment has at least the given value
      (function template)[edit]

      [edit]Low level memory management

      Includes e.g.operator new,operator delete,std::set_new_handler.

      Defined in header<new>

      [edit]C-style memory management

      Includes e.g.std::malloc,std::free.

      Defined in header<cstdlib>

      [edit]Uninitialized storage(until C++20)

      Several utilities are provided to create and access raw storage.

      Defined in header<memory>
      (deprecated in C++17)(removed in C++20)
      an iterator that allows standard algorithms to store results in uninitialized memory
      (class template)[edit]
      (deprecated in C++17)(removed in C++20)
      obtains uninitialized storage
      (function template)[edit]
      (deprecated in C++17)(removed in C++20)
      frees uninitialized storage
      (function template)[edit]

      [edit]Garbage collector support(until C++23)

      Defined in header<memory>
      (C++11)(removed in C++23)
      declares that an object can not be recycled
      (function)[edit]
      (C++11)(removed in C++23)
      declares that an object can be recycled
      (function template)[edit]
      (C++11)(removed in C++23)
      declares that a memory area does not contain traceable pointers
      (function)[edit]
      (C++11)(removed in C++23)
      cancels the effect ofstd::declare_no_pointers
      (function)[edit]
      (C++11)(removed in C++23)
      lists pointer safety models
      (enum)[edit]
      (C++11)(removed in C++23)
      returns the current pointer safety model
      (function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/memory&oldid=182466"

      [8]ページ先頭

      ©2009-2025 Movatter.jp