Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::uses_allocator<std::tuple>

      From cppreference.com
      <cpp‎ |utility‎ |tuple
       
       
      Utilities library
       
       
      Defined in header<tuple>
      template<class...Types,class Alloc>
      struct uses_allocator<std::tuple<Types...>, Alloc>:std::true_type{};
      (since C++11)

      This specialization ofstd::uses_allocator informs other library components that tuples supportuses-allocator construction, even though they do not have a nestedallocator_type.

      Contents

      Inherited fromstd::integral_constant

      Member constants

      value
      [static]
      true
      (public static member constant)

      Member functions

      operator bool
      converts the object tobool, returnsvalue
      (public member function)
      operator()
      (C++14)
      returnsvalue
      (public member function)

      Member types

      Type Definition
      value_typebool
      typestd::integral_constant<bool, value>

      [edit]Example

      // myalloc is a stateful Allocator with a single-argument constructor// that takes an int. It has no default constructor. using innervector_t=std::vector<int, myalloc<int>>;using elem_t=std::tuple<int, innervector_t>;using Alloc=std::scoped_allocator_adaptor< myalloc<elem_t>, myalloc<int>>;     Alloc a(1,2);std::vector<elem_t, Alloc> v(a);    v.resize(1);// uses allocator #1 for elements of v    std::get<1>(v[0]).resize(10);// uses allocator #2 for innervector_t

      [edit]See also

      checks if the specified type supports uses-allocator construction
      (class template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/tuple/uses_allocator&oldid=142346"

      [8]ページ先頭

      ©2009-2025 Movatter.jp