5 #ifndef EASTL_FIXEDTUPLEVECTOR_H
6 #define EASTL_FIXEDTUPLEVECTOR_H
8 #include <EASTL/bonus/tuple_vector.h>
9 #include <EASTL/internal/fixed_pool.h>
11 #if defined(EA_PRAGMA_ONCE_SUPPORTED)
24 #ifndef EASTL_FIXED_TUPLE_VECTOR_DEFAULT_NAME
25 #define EASTL_FIXED_TUPLE_VECTOR_DEFAULT_NAME EASTL_DEFAULT_NAME_PREFIX " fixed_tuple_vector"
31 #ifndef EASTL_FIXED_TUPLE_VECTOR_DEFAULT_ALLOCATOR
32 #define EASTL_FIXED_TUPLE_VECTOR_DEFAULT_ALLOCATOR overflow_allocator_type(EASTL_FIXED_TUPLE_VECTOR_DEFAULT_NAME)
36 template <
size_t nodeCount,
bool bEnableOverflow,
typename... Ts>
38 TupleVecInternal::TupleRecurser<Ts...>::GetTotalAllocationSize(nodeCount, 0), 1,
39 TupleVecInternal::TupleRecurser<Ts...>::GetTotalAlignment(), 0,
40 bEnableOverflow, EASTLAllocatorType>, make_index_sequence<sizeof...(Ts)>, Ts...>
44 TupleVecInternal::TupleRecurser<Ts...>::GetTotalAllocationSize(nodeCount, 0), 1,
45 TupleVecInternal::TupleRecurser<Ts...>::GetTotalAlignment(), 0,
49 typedef EASTLAllocatorType overflow_allocator_type;
51 typedef TupleVecInternal::TupleVecImpl<
fixed_allocator_type, make_index_sequence<
sizeof...(Ts)>, Ts...> base_type;
52 typedef typename base_type::size_type size_type;
59 : base_type(
fixed_allocator_type(mBuffer.buffer), mBuffer.buffer, nodeCount, fixed_allocator_type::kNodeSize)
67 : base_type(
fixed_allocator_type(mBuffer.buffer), mBuffer.buffer, nodeCount, fixed_allocator_type::kNodeSize)
69 base_type::get_allocator().copy_overflow_allocator(x.get_allocator());
70 base_type::DoInitFromIterator(make_move_iterator(x.begin()), make_move_iterator(x.end()));
77 base_type::DoInitFromIterator(make_move_iterator(x.begin()), make_move_iterator(x.end()));
82 : base_type(
fixed_allocator_type(mBuffer.buffer), mBuffer.buffer, nodeCount, fixed_allocator_type::kNodeSize)
84 base_type::get_allocator().copy_overflow_allocator(x.get_allocator());
85 base_type::DoInitFromIterator(x.begin(), x.end());
91 base_type::DoInitFromIterator(x.begin(), x.end());
94 template <
typename MoveIterBase>
98 base_type::DoInitFromIterator(begin, end);
101 template <
typename Iterator>
102 fixed_tuple_vector(Iterator begin, Iterator end,
const overflow_allocator_type&
allocator = EASTL_FIXED_TUPLE_VECTOR_DEFAULT_ALLOCATOR)
105 base_type::DoInitFromIterator(begin, end);
111 base_type::DoInitDefaultFill(n);
115 : base_type(
fixed_allocator_type(mBuffer.buffer), mBuffer.buffer, nodeCount, fixed_allocator_type::kNodeSize)
117 base_type::DoInitFillArgs(n, args...);
123 base_type::DoInitFillArgs(n, args...);
127 typename base_type::const_reference_tuple tup,
128 const overflow_allocator_type&
allocator = EASTL_FIXED_TUPLE_VECTOR_DEFAULT_ALLOCATOR)
131 base_type::DoInitFillTuple(n, tup);
134 fixed_tuple_vector(
const typename base_type::value_tuple* first,
const typename base_type::value_tuple* last,
135 const overflow_allocator_type&
allocator = EASTL_FIXED_TUPLE_VECTOR_DEFAULT_ALLOCATOR)
138 base_type::DoInitFromTupleArray(first, last);
142 const overflow_allocator_type&
allocator = EASTL_FIXED_TUPLE_VECTOR_DEFAULT_ALLOCATOR)
145 base_type::DoInitFromTupleArray(iList.begin(), iList.end());
150 base_type::operator=(other);
158 base_type::DoInitFromIterator(make_move_iterator(other.begin()), make_move_iterator(other.end()));
165 base_type::operator=(iList);
173 if ((has_overflowed() && x.has_overflowed()) && (get_overflow_allocator() == x.get_overflow_allocator()))
180 eastl::fixed_swap(*
this, x);
185 size_type max_size()
const {
return nodeCount; }
189 bool full()
const {
return (base_type::mNumElements >= nodeCount) || ((
void*)base_type::mpData != (
void*)mBuffer.buffer); }
192 bool has_overflowed()
const {
return ((
void*)base_type::mpData != (
void*)mBuffer.buffer); }
194 bool can_overflow()
const {
return bEnableOverflow; }
196 const overflow_allocator_type& get_overflow_allocator()
const {
return base_type::get_allocator().get_overflow_allocator(); }
200 template <
size_t nodeCount,
bool bEnableOverflow,
typename... Ts>
Definition: allocator.h:52
Definition: fixed_tuple_vector.h:41
Definition: fixed_pool.h:1329
Definition: iterator.h:411
Definition: initializer_list.h:38
EA Standard Template Library.
Definition: algorithm.h:288