Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::allocator_traits<Alloc>::select_on_container_copy_construction

      From cppreference.com
      <cpp‎ |memory‎ |allocator traits
       
       
      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>
      static Alloc select_on_container_copy_construction(const Alloc& a);
      (since C++11)
      (constexpr since C++20)

      If possible, obtains the copy-constructed version of the allocatora, by callinga.select_on_container_copy_construction(). If the above is not possible (e.g.Alloc does not have the member functionselect_on_container_copy_construction()), then returnsa, unmodified.

      This function is called by the copy constructors of all standard library containers. It allows the allocator used by the constructor's argument to become aware that the container is being copied and modify state if necessary.

      [edit]Parameters

      a - allocator used by a standard container passed as an argument to a container copy constructor

      [edit]Return value

      The allocator to use by the copy-constructed standard containers.

      [edit]See also

      copies the state ofscoped_allocator_adaptor and all its allocators
      (public member function ofstd::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/memory/allocator_traits/select_on_container_copy_construction&oldid=173091"

      [8]ページ先頭

      ©2009-2025 Movatter.jp