Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::allocation_result

      From cppreference.com
      <cpp‎ |memory
       
       
      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)
       
      Defined in header<memory>
      template<class Pointer,class SizeType=std::size_t>
      struct allocation_result;
      (since C++23)

      allocation_result specializations are returned from theallocate_at_least member function of appropriateAllocator types (e.g.std::allocator::allocate_at_least) andstd::allocator_traits::allocate_at_least.

      Every specialization ofallocation_result has no base classes or declared members other thanptr andcount, thus it is suitable foraggregate initialization andstructured binding.

      Contents

      [edit]Template parameters

      Pointer - typicallystd::allocator_traits<Alloc>::pointer, whereAlloc is anAllocator type
      SizeType - typicallystd::allocator_traits<Alloc>::size_type, whereAlloc is anAllocator type

      [edit]Data members

      Member name Definition
      ptr
      a pointer of typePointer which is typically used for the address of the first element in the storage allocated byallocate_at_least
      (public member object)
      count
      a value of typeSizeType which is typically used for the actual number of elements in the storage allocated byallocate_at_least
      (public member object)

      [edit]Notes

      Pointer andSizeType are a pointer to an object type andstd::make_unsigned_t<std::ptrdiff_t> (which is almost always same asstd::size_t) by default.

      Feature-test macroValueStdFeature
      __cpp_lib_allocate_at_least202302L(C++23)Size-feedback in the Allocator interface

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]See also

      allocates uninitialized storage at least as large as requested size
      (public member function ofstd::allocator<T>)[edit]
      [static](C++23)
      allocates storage at least as large as the requested size via an allocator
      (public static member function ofstd::allocator_traits<Alloc>)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/memory/allocation_result&oldid=170864"

      [8]ページ先頭

      ©2009-2025 Movatter.jp