5 #include <libutl/Array.h> 33 typedef T*
const* iterator;
49 bool keepSorted =
false,
51 :
Array(size, increment, owner, multiSet, keepSorted, ordering)
62 TArray(
bool owner,
bool multiSet =
true,
bool keepSorted =
false,
Ordering* ordering =
nullptr)
63 :
Array(owner, multiSet, keepSorted, ordering)
72 return utl::cast<T>(Array::get(idx));
79 findT(
const Object& key)
const 81 return utl::cast<T>(Array::find(key));
85 findIt(
const Object& key)
const 87 return (iterator)Array::findIt(key);
93 super::findIt(key, it);
99 super::findIt(key, it);
103 findFirstIt(
const Object& key,
bool insert =
false)
105 return (iterator)Array::findFirstIt(key, insert);
109 findFirstIt(
const Object& key,
BidIt& it,
bool insert =
false)
const 111 super::findFirstIt(key, it, insert);
117 super::findFirstIt(key, it, insert);
121 findLastIt(
const Object& key)
123 return (iterator)Array::findLastIt(key);
129 super::findLastIt(key, it);
135 super::findLastIt(key, it);
144 return super::add(
object);
150 return super::add(
object);
154 add(
const Object*
object,
bool keepSorted)
156 return super::add(
object, keepSorted);
162 super::add(collection);
166 add(
size_t idx,
size_t num = 1)
168 super::add(idx, num);
172 add(
size_t idx,
const Object&
object)
174 super::add(idx,
object);
178 add(
size_t idx,
const Object*
object)
180 super::add(idx,
object);
184 insert(
const Object&
object, iterator it)
186 super::insert(
object, (Array::iterator)it);
190 insert(
const Object*
object, iterator it)
192 super::insert(
object, (Array::iterator)it);
198 super::insert(
object, it);
204 super::insert(
object, it);
211 removeIt(iterator it)
213 super::removeIt((Array::iterator)it);
217 removeIt(iterator begin, iterator end)
219 super::removeIt((Array::iterator)begin, (Array::iterator)end);
231 super::removeIt(begin, end);
238 replace(iterator it,
const Object* newObject)
240 super::replace((Array::iterator)it, newObject);
246 super::replace(it, newObject);
250 replace(
const Object* oldObject,
const Object* newObject)
252 super::replace(oldObject, newObject);
256 replace(
size_t idx,
const Object* newObject)
258 super::replace(idx, newObject);
265 relocate(iterator destIt, iterator srcIt)
267 super::relocate((Array::iterator)destIt, (Array::iterator)srcIt);
271 relocate(
size_t destIdx,
size_t srcIdx)
273 super::relocate(destIdx, srcIdx);
282 return (iterator)Array::begin();
288 return (iterator)Array::end();
294 T* operator[](
size_t idx)
const 296 return utl::cast<T>(Array::operator[](idx));
299 T* operator[](
int idx)
const 301 return operator[]((
size_t)idx);
304 T* operator[](
size_t idx)
306 return utl::cast<T>(Array::operator[](idx));
309 T* operator[](
int idx)
311 return operator[]((
size_t)idx);
314 #if UTL_HOST_WORDSIZE == 64 315 T* operator[](
uint_t idx)
const 317 return operator[]((
size_t)idx);
321 return operator[]((
size_t)idx);
325 T& operator()(
size_t idx)
const 327 auto ptr = utl::cast<T>(Array::operator[](idx));
332 T* operator[](
const Object*
object)
334 return utl::cast<T>(addOrFind(
object));
337 T& operator()(
int idx)
const 339 return operator()((
size_t)idx);
342 #if UTL_HOST_WORDSIZE == 64 343 T& operator()(
uint_t idx)
const 345 return operator()((
size_t)idx);
#define UTL_CLASS_IMPL_TPL(className, T)
Implementation of standard UTL++ functionality for a template class.
void insert(const Object *object, const BidIt &it)
Insert an object before the pointed-to location.
#define UTL_CLASS_DEFID
Default init() and deInit() (which are merely place-holders).
Random-access Array iterator.
Object comparison abstraction.
TArray(size_t size, size_t increment=uint_t_max, bool owner=true, bool multiSet=true, bool keepSorted=false, Ordering *ordering=nullptr)
Constructor.
SortedCollection that stores objects in an array.
Template version of Array.
unsigned int uint_t
Unsigned integer.
void removeIt(BidIt &it)
Remove the object the given iterator points to.
const uint_t uint_t_max
Maximum uint_t value.
void findIt(const Object &key, BidIt &it)
Find an object matching a given key.
Bi-directional iterator abstraction.
void findFirstIt(const Object &key, BidIt &it, bool insert=false)
Find the first object matching the given key.
#define UTL_CLASS_DECL_TPL(DC, T, BC)
Declaration of standard UTL++ functionality for a template class with one parameter.
TArray(bool owner, bool multiSet=true, bool keepSorted=false, Ordering *ordering=nullptr)
Constructor.
Root of UTL++ class hierarchy.
#define ASSERTD
Do an assertion in DEBUG mode only.
void findLastIt(const Object &key, BidIt &it)
Find the last object matching the given key.