std::uses_allocatorstd::tuple - cppreference.com (original) (raw)

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.

[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>; using elem_t = std::tuple<int, innervector_t>; using Alloc = std::scoped_allocator_adaptor< myalloc, myalloc>;   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] | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |