Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::pmr::polymorphic_allocator<T>::polymorphic_allocator

      From cppreference.com
      <cpp‎ |memory‎ |polymorphic allocator
       
       
      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)
       
       
      polymorphic_allocator()noexcept;
      (1)
      polymorphic_allocator(const polymorphic_allocator& other)=default;
      (2)
      template<class U>
      polymorphic_allocator(const polymorphic_allocator<U>& other)noexcept;
      (3)
      polymorphic_allocator(std::pmr::memory_resource* r);
      (4)

      Constructs a newpolymorphic_allocator.

      1) Constructs apolymorphic_allocator using the return value ofstd::pmr::get_default_resource() as the underlying memory resource.
      2,3) Constructs apolymorphic_allocator usingother.resource() as the underlying memory resource.
      4) Constructs apolymorphic_allocator usingr as the underlying memory resource. This constructor provides an implicit conversion fromstd::pmr::memory_resource*.

      Contents

      [edit]Parameters

      other - anotherpolymorphic_allocator to copy from
      r - pointer to the memory resource to use. May not be null

      [edit]Exceptions

      4) Throws nothing.

      [edit] Notes

      Copying a container using apolymorphic_allocator will not call the allocator's copy constructor. Instead, the new container will use the return value ofselect_on_container_copy_construction (a default-constructedpolymorphic_allocator) as its allocator.

      [edit] See also

      create a newpolymorphic_allocator for use by a container's copy constructor
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/memory/polymorphic_allocator/polymorphic_allocator&oldid=160247"

      [8]ページ先頭

      ©2009-2025 Movatter.jp