std::uses_allocator<std::tuple> (3) - Linux Man Pages

std::uses_allocator<std::tuple>: std::uses_allocator<std::tuple>

NAME

std::uses_allocator<std::tuple> - std::uses_allocator<std::tuple>

Synopsis


Defined in header <tuple>
template< class... Types, class Alloc > (since C++11)
struct uses_allocator< std::tuple<Types...>, Alloc > : std::true_type { };


This specialization of std::uses_allocator informs other library components that tuples support uses-allocator construction, even though they do not have a nested allocator_type.


Inherited from std::integral_constant

Member constants


value true
         (public static member constant)
[static]

Member functions


              converts the object to bool, returns value
operator bool (public member function)


operator() returns value
              (public member function)
(C++14)

Member types


Type Definition
value_type bool
type std::integral_constant<bool, value>

Example


// Run this code


  // myalloc is a stateful Allocator with a single-argument constructor
  // that takes an int. It has no default constructor.


      typedef std::vector<int, myalloc<int>> innervector_t;
      typedef std::tuple<int, innervector_t> elem_t;
      typedef std::scoped_allocator_adaptor< myalloc<elem_t>, myalloc<int>> Alloc;
      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

See also


uses_allocator checks if the specified type supports uses-allocator construction
               (class template)
(C++11)