std::uses_allocator<std::tuple>
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Utilities library
Type support (basic types, RTTI)
Library feature-test macros (C++20)
(C++11)
(C++20)
(C++26)
(C++20)
Coroutine support (C++20)
Contract support (C++26)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)(C++20)
(C++20)(C++20)(C++20)
General utilities
Relational operators (deprecated in C++20)
(C++20)(C++20)(C++20)
(C++20)(C++20)(C++20)
(C++20)
Swap and type operations
Common vocabulary types
std::tuple
(until C++20)(until C++20)(until C++20)(until C++20)(until C++20)(C++20)
(C++23)
uses_allocator<std::tuple>
(C++23)
(C++23)
Deduction guides (C++17)
Defined in header
<tuple>
template< class... Types, class Alloc >
struct uses_allocator< std::tuple <Types...>, Alloc > : std::true_type { };
(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
.
Contents
Inherited from std::integral_constant
Member constants
value
[static]
(public static member constant)
Member functions
operator bool
(public member function)
operator()
(C++14)
(public member function)
Member types
Type
Definition
value_type
bool
type
std::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