11 public base_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >
17 using BASE_ARRAY = base_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >;
18 using RAW_BASE_ARRAY =
typename BASE_ARRAY::RAW_BASE_ARRAY;
20 using THIS_ARRAY = array_base < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >;
24 using BASE_TYPE = TYPE;
25 using BASE_ARG_TYPE = ARG_TYPE;
28 using BASE_RAW_RANGE =
typename BASE_ARRAY::BASE_RAW_RANGE;
31 using iterator =
typename BASE_ARRAY::iterator;
32 using const_iterator =
typename BASE_ARRAY::const_iterator;
34 using this_iterator =
typename BASE_ARRAY::this_iterator;
36 using ITERATOR_RANGE =
typename BASE_ARRAY::ARRAY_RANGE;
38 using CONST_RANGE =
typename BASE_ARRAY::CONST_RANGE;
39 using CONST_RAW_RANGE =
typename BASE_ARRAY::CONST_RAW_RANGE;
41 using BASE_ARRAY::BASE_ARRAY;
42 using BASE_ARRAY::operator =;
43 using BASE_ARRAY::operator +=;
45 array_base(
const RAW_BASE_ARRAY & a) : BASE_ARRAY(a) { }
75 inline const TYPE & get_at(::collection::index nIndex)
const;
76 inline TYPE & get_at(::collection::index nIndex);
77 inline void set_at(::collection::index nIndex, ARG_TYPE newElement);
84 inline ::collection::index add_item(ARG_TYPE newElement);
87 inline ::collection::index add(ARG_TYPE newElement);
88 inline ::collection::index add_copies(ARG_TYPE newElement, ::collection::count cCopies)
90 ::collection::index iLastInsertIndex = -1;
94 iLastInsertIndex =add_item(newElement);
100 return iLastInsertIndex;
114 template <
typename CONTAINER >
118 auto array_base = *
this;
120 array_base.append_container(container);
122 return ::transfer(array_base);
132 inline TYPE & add_new(::collection::count c = 1);
135 inline TYPE & add_new_at(::collection::index iIndex, ::collection::count count = 1);
138 inline array_base & operator << (ARG_TYPE newElement) { add(newElement);
return *
this; }
164 template <
class ARRAY >
165 inline ::collection::count slice(ARRAY & a, ::collection::index iStart = 0, ::collection::count nCount = -1)
168 ::collection::count ca = 0;
170 ::collection::index iEnd;
173 iEnd = this->get_upper_bound(nCount);
175 iEnd = iStart + nCount - 1;
177 for (::collection::index i = iStart; i <= iEnd; i++)
180 a.add(this->element_at(i));
189 template <
typename ARRAY >
190 inline ARRAY slice(::collection::index iStart = 0, ::collection::count nCount = -1)
195 slice(a, iStart, nCount);
207 template <
typename... T >
215 template <
typename PREDICATE >
216 ::collection::index predicate_index_index(::collection::index iPredicateIndex, PREDICATE predicate)
219 if (iPredicateIndex < 0)
226 for (::collection::index iIndex = 0; iIndex < this->get_size(); iIndex++)
229 auto & element = this->element_at(iIndex);
231 if (predicate(element))
234 if (iPredicateIndex <= 0)
251 template <
typename PREDICATE >
252 ::collection::index index_predicate_index(::collection::index iIndex, PREDICATE predicate)
255 ::collection::index iPredicateIndex = -1;
257 ::collection::index i = 0;
259 for (; i <= iIndex && i < this->get_size(); i++)
262 auto & element = this->element_at(i);
264 if (predicate(element))
280 return iPredicateIndex;
284 template <
typename PRED >
285 bool predicate_add_unique(TYPE t, PRED pred)
288 if (this->predicate_contains(pred))
303 template <
typename ITERABLE >
304 base_array< TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & copy_iter(
const ITERABLE & iterable)
307 this->set_size(0, maximum(__iterable_count(iterable), 17));
309 for (
auto & item : iterable)