107 template <
typename ArrayT,
typename ValueT>
108 bool DoesContain(
const ArrayT& arr,
const ValueT& value)
110 for (UPInt i = 0; i < arr.GetSize(); ++i)
118 template <
typename ArrayT>
119 void RemoveConsecutiveDuplicates(ArrayT& arr)
121 if (arr.GetCount() == 0)
125 for (UPInt readIdx = 1; readIdx < arr.GetSize(); ++readIdx)
127 if (arr[writeIdx] != arr[readIdx])
130 arr[writeIdx] = arr[readIdx];
133 arr.Resize(writeIdx + 1);
136 template<
typename T1,
typename T2>
137 bool IsEqual(
const T1& a1,
const T2& a2)
139 if (a1.GetCount() != a2.GetCount())
142 for (
KyUInt32 i = 0; i < a1.GetCount(); ++i)
161 template<
class T,
int SID=Stat_Default_Mem,
class SizePolicy=KyArrayDefaultPolicy>
162 class KyArray :
public Array<T, SID, SizePolicy>
169 typedef Array<T, SID, SizePolicy> BaseType;
174 explicit KyArray(
int size) : BaseType(size) {}
175 KyArray(
const SelfType& a) : BaseType(a) {}
176 const SelfType& operator=(
const SelfType& a) { BaseType::operator=(a);
return *
this; }
180 bool operator==(
const SelfType& other)
const {
return ArrayAlg::IsEqual(*
this, other); }
181 bool operator!=(
const SelfType& other) {
return !operator==(other); }
183 bool DoesContain(
const ValueType& value)
const {
return ArrayAlg::DoesContain<SelfType,ValueType>(*
this, value); }
184 void RemoveConsecutiveDuplicates() { ArrayAlg::RemoveConsecutiveDuplicates<SelfType>(*this); }
185 void StealFrom(SelfType& other) { this->Data.StealFrom(other.Data); }
193 template<
class T,
int SID=Stat_Default_Mem,
class SizePolicy=KyArrayDefaultPolicy>
201 typedef ArrayPOD<T, SID, SizePolicy> BaseType;
207 explicit KyArrayPOD(
int size) : BaseType(size) {}
208 KyArrayPOD(
const SelfType& a) : BaseType(a) {}
209 const SelfType& operator=(
const SelfType& a) { BaseType::operator=(a);
return *
this; }
213 bool operator==(
const SelfType& other)
const {
return ArrayAlg::IsEqual(*
this, other); }
214 bool operator!=(
const SelfType& other) {
return !operator==(other); }
216 bool DoesContain(
const ValueType& value)
const {
return ArrayAlg::DoesContain<SelfType,ValueType>(*
this, value); }
217 void RemoveConsecutiveDuplicates() { ArrayAlg::RemoveConsecutiveDuplicates<SelfType>(*this); }
218 void StealFrom(SelfType& other) { this->Data.StealFrom(other.Data); }
224 template<
class T,
int SID=Stat_Default_Mem,
class SizePolicy=KyArrayDefaultPolicy>
232 typedef ArrayLH<T, SID, SizePolicy> BaseType;
238 explicit KyArrayLH(
int size) : BaseType(size) {}
239 KyArrayLH(
const SelfType& a) : BaseType(a) {}
240 const SelfType& operator=(
const SelfType& a) { BaseType::operator=(a);
return *
this; }
244 bool operator==(
const SelfType& other)
const {
return ArrayAlg::IsEqual(*
this, other); }
245 bool operator!=(
const SelfType& other) {
return !operator==(other); }
247 bool DoesContain(
const ValueType& value)
const {
return ArrayAlg::DoesContain<SelfType,ValueType>(*
this, value); }
248 void RemoveConsecutiveDuplicates() { ArrayAlg::RemoveConsecutiveDuplicates<SelfType>(*this); }
249 void StealFrom(SelfType& other) { this->Data.StealFrom(other.Data); }
255 template<
class T,
int SID=Stat_Default_Mem,
class SizePolicy=KyArrayDefaultPolicy>
256 class KyArrayCPP :
public ArrayCPP<T, SID, SizePolicy>
262 typedef KyArrayCPP<T, SID, SizePolicy> SelfType;
263 typedef ArrayCPP<T, SID, SizePolicy> BaseType;
268 KyArrayCPP() : BaseType() {}
269 explicit KyArrayCPP(
int size) : BaseType(size) {}
270 KyArrayCPP(
const SelfType& a) : BaseType(a) {}
271 const SelfType& operator=(
const SelfType& a) { BaseType::operator=(a);
return *
this; }
275 bool operator==(
const SelfType& other)
const {
return ArrayAlg::IsEqual(*
this, other); }
276 bool operator!=(
const SelfType& other) {
return !operator==(other); }
278 bool DoesContain(
const ValueType& value)
const {
return ArrayAlg::DoesContain<SelfType,ValueType>(*
this, value); }
279 void RemoveConsecutiveDuplicates() { ArrayAlg::RemoveConsecutiveDuplicates<SelfType>(*this); }
280 void StealFrom(SelfType& other) { this->Data.StealFrom(other.Data); }
287 template<
class T,
int SID=Stat_Default_Mem,
class SizePolicy=KyArrayDefaultPolicy>
295 typedef ArrayLH_POD<T, SID, SizePolicy> BaseType;
303 const SelfType& operator=(
const SelfType& a) { BaseType::operator=(a);
return *
this; }
307 bool operator==(
const SelfType& other)
const {
return ArrayAlg::IsEqual(*
this, other); }
308 bool operator!=(
const SelfType& other) {
return !operator==(other); }
310 bool DoesContain(
const ValueType& value)
const {
return ArrayAlg::DoesContain<SelfType,ValueType>(*
this, value); }
311 void RemoveConsecutiveDuplicates() { ArrayAlg::RemoveConsecutiveDuplicates<SelfType>(*this); }
312 void StealFrom(SelfType& other) { this->Data.StealFrom(other.Data); }
318 template<
class T,
int SID=Stat_Default_Mem,
class SizePolicy=KyArrayDefaultPolicy>
319 class KyArrayLH_CPP :
public ArrayLH_CPP<T, SID, SizePolicy>
325 typedef KyArrayLH_CPP<T, SID, SizePolicy> SelfType;
326 typedef ArrayLH_CPP<T, SID, SizePolicy> BaseType;
331 KyArrayLH_CPP() : BaseType() {}
332 explicit KyArrayLH_CPP(
int size) : BaseType(size) {}
333 KyArrayLH_CPP(
const SelfType& a) : BaseType(a) {}
334 const SelfType& operator=(
const SelfType& a) { BaseType::operator=(a);
return *
this; }
338 bool operator==(
const SelfType& other)
const {
return ArrayAlg::IsEqual(*
this, other); }
339 bool operator!=(
const SelfType& other) {
return !operator==(other); }
341 bool DoesContain(
const ValueType& value)
const {
return ArrayAlg::DoesContain<SelfType,ValueType>(*
this, value); }
342 void RemoveConsecutiveDuplicates() { ArrayAlg::RemoveConsecutiveDuplicates<SelfType>(*this); }
343 void StealFrom(SelfType& other) { this->Data.StealFrom(other.Data); }
349 template<
class T,
int SID=Stat_Default_Mem,
class SizePolicy=KyArrayDefaultPolicy>
357 typedef ArrayDH<T, SID, SizePolicy> BaseType;
362 explicit KyArrayDH(MemoryHeap* heap) : BaseType(heap) {}
363 KyArrayDH(MemoryHeap* heap,
int size) : BaseType(heap, size) {}
364 KyArrayDH(MemoryHeap* heap,
const SelfType& a) : BaseType(heap, a) {}
365 const SelfType& operator=(
const SelfType& a) { BaseType::operator=(a);
return *
this; }
369 bool operator==(
const SelfType& other)
const {
return ArrayAlg::IsEqual(*
this, other); }
370 bool operator!=(
const SelfType& other) {
return !operator==(other); }
372 bool DoesContain(
const ValueType& value)
const {
return ArrayAlg::DoesContain<SelfType,ValueType>(*
this, value); }
373 void RemoveConsecutiveDuplicates() { ArrayAlg::RemoveConsecutiveDuplicates<SelfType>(*this); }
374 void StealFrom(SelfType& other) { this->Data.StealFrom(other.Data); }
382 template<
class T,
int SID=Stat_Default_Mem,
class SizePolicy=KyArrayDefaultPolicy>
390 typedef ArrayDH_POD<T, SID, SizePolicy> BaseType;
396 KyArrayDH_POD(MemoryHeap* heap,
int size) : BaseType(heap, size) {}
397 KyArrayDH_POD(MemoryHeap* heap,
const SelfType& a) : BaseType(heap, a) {}
398 const SelfType& operator=(
const SelfType& a) { BaseType::operator=(a);
return *
this; }
402 bool operator==(
const SelfType& other)
const {
return ArrayAlg::IsEqual(*
this, other); }
403 bool operator!=(
const SelfType& other) {
return !operator==(other); }
405 bool DoesContain(
const ValueType& value)
const {
return ArrayAlg::DoesContain<SelfType,ValueType>(*
this, value); }
406 void RemoveConsecutiveDuplicates() { ArrayAlg::RemoveConsecutiveDuplicates<SelfType>(*this); }
407 void StealFrom(SelfType& other) { this->Data.StealFrom(other.Data); }
414 template<
class T,
int SID=Stat_Default_Mem,
class SizePolicy=KyArrayDefaultPolicy>
415 class KyArrayDH_CPP :
public ArrayDH_CPP<T, SID, SizePolicy>
421 typedef KyArrayDH_CPP<T, SID, SizePolicy> SelfType;
422 typedef ArrayDH_CPP<T, SID, SizePolicy> BaseType;
427 explicit KyArrayDH_CPP(MemoryHeap* heap) : BaseType(heap) {}
428 KyArrayDH_CPP(MemoryHeap* heap,
int size) : BaseType(heap, size) {}
429 KyArrayDH_CPP(MemoryHeap* heap,
const SelfType& a) : BaseType(heap, a) {}
430 const SelfType& operator=(
const SelfType& a) { BaseType::operator=(a);
return *
this; }
434 bool operator==(
const SelfType& other)
const {
return ArrayAlg::IsEqual(*
this, other); }
435 bool operator!=(
const SelfType& other) {
return !operator==(other); }
437 bool DoesContain(
const ValueType& value)
const {
return ArrayAlg::DoesContain<SelfType,ValueType>(*
this, value); }
438 void RemoveConsecutiveDuplicates() { ArrayAlg::RemoveConsecutiveDuplicates<SelfType>(*this); }
439 void StealFrom(SelfType& other) { this->Data.StealFrom(other.Data); }
General purpose array for movable objects that DOES NOT require construction/destruction.
Definition: kyarray.h:194
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
General purpose array for movable objects that require explicit construction/destruction.
Definition: kyarray.h:162
General purpose array for movable objects that DOES NOT require construction/destruction.
Definition: kyarray.h:383
General purpose array for movable objects that DOES NOT require construction/destruction.
Definition: kyarray.h:288
ArrayConstPolicy< 0, 4, true > KyArrayDefaultPolicy
Default resize behavior for Autodesk Navigation array.
Definition: kyarray.h:155
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
General purpose array for movable objects that require explicit construction/destruction.
Definition: kyarray.h:350
General purpose array for movable objects that require explicit construction/destruction.
Definition: kyarray.h:225