Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::experimental::pmr::resource_adaptor,std::pmr::experimental::resource_adaptor

      From cppreference.com
      <cpp‎ |experimental
       
       
       
       
       
      template<class Alloc>

      using resource_adaptor=/*resource-adaptor-imp*/<
                                   typenamestd::allocator_traits<Alloc>::

                                   template rebind_alloc<char>>;
      (library fundamentals TS)
      template<class Alloc>
      class/*resource-adaptor-imp*/:public memory_resource;// for exposition only
      (library fundamentals TS)

      The alias templateresource_adaptor adapts the allocator typeAlloc with amemory_resource interface. The allocator is rebound to achar value type before it is actually adapted (using theresource-adaptor-imp class template), so that adapting specializations of the same allocator template always yields the same type, regardless of the value type the allocator template is originally instantiated with.

      resource_adaptor is defined in namespacestd::experimental::pmr, and the base typememory_resorce in this page isstd::experimental::pmr::memory_resource.

      (library fundamentals TS)
      (until library fundamentals TS v3)

      resource_adaptor is defined in namespacestd::pmr::experimental, and the base typememory_resorce in this page isstd::pmr::memory_resource.

      (library fundamentals TS v3)

      resource-adaptor-imp is a class template whose members are described below. The nameresource-adaptor-imp is for exposition purposes only and not normative.

      In addition to meeting theAllocator requirements,Alloc must additionally satisfy the following requirements:

      [edit]Member types ofresource-adaptor-imp

      Member type Definition
      allocator_typeAlloc

      [edit]Member functions ofresource-adaptor-imp

      resource-adaptor-imp::resource-adaptor-imp

      /*resource-adaptor-imp*/()=default;
      (1)(library fundamentals TS)
      /*resource-adaptor-imp*/(const/*resource-adaptor-imp*/& other)
         =default;
      (2)(library fundamentals TS)
      /*resource-adaptor-imp*/(/*resource-adaptor-imp*/&& other)
         =default;
      (3)(library fundamentals TS)
      explicit/*resource-adaptor-imp*/(const Alloc& a2);
      (4)(library fundamentals TS)
      explicit/*resource-adaptor-imp*/(Alloc&& a2);
      (5)(library fundamentals TS)
      1) Default constructor. Default constructs the wrapped allocator.
      2) Copy constructor. Copy constructs the wrapped allocator from the allocator wrapped byother.
      3) Move constructor. Move constructs the wrapped allocator from the allocator wrapped byother.
      4) Initializes the wrapped allocator witha2.
      5) Initializes the wrapped allocator withstd::move(a2).

      Parameters

      other - anotherresource-adaptor-imp object to copy or move from
      a2 - anotherAlloc object to copy or move from

      resource-adaptor-imp::get_allocator

      allocator_type get_allocator()const;
      (library fundamentals TS)

      Returns a copy of the wrapped allocator.

      resource-adaptor-imp::operator=

      /*resource-adaptor-imp*/& operator=(const/*resource-adaptor-imp*/& other)
         =default;
      (library fundamentals TS)

      Defaulted copy assignment operator. Copy assigns the wrapped allocator from that ofother.

      resource-adaptor-imp::do_allocate

      protected:
      virtualvoid* do_allocate(std::size_t bytes,std::size_t alignment);
      (library fundamentals TS)

      Allocates memory using theallocate member function of the wrapped allocator.

      resource-adaptor-imp::do_deallocate

      protected:
      virtualvoid do_deallocate(void*p,std::size_t bytes,std::size_t alignment);
      (library fundamentals TS)

      Deallocates the storage pointed to byp using thedeallocate member function of the wrapped allocator.

      p must have been allocated using theallocate member function of an allocator that compares equal to the wrapped allocator, and must not have been subsequently deallocated.

      resource-adaptor-imp::do_is_equal

      protected:
      virtualbool do_is_equal(const memory_resource& other)constnoexcept;
      (library fundamentals TS)

      Letp bedynamic_cast<const/*resource-adaptor-imp*/*>(&other). Ifp is a null pointer value, returnsfalse. Otherwise, return the result of comparing the allocators wrapped by*p and*this usingoperator==.

      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/resource_adaptor&oldid=150327"

      [8]ページ先頭

      ©2009-2025 Movatter.jp