acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_aaa_array_base1.h
1#pragma once
2
3//
4//#include "_iterator.h"
5//#include "acme/memory/typed.h"
6//#include "acme/memory/typed_memory.h"
7//#include "acme/platform/common.h"
8//
10//
11//
12//CLASS_DECL_ACME ::string get_task_object_name();
13//
14//#ifdef _DEBUG
15//
16//CLASS_DECL_ACME ::string get_task_object_debug();
17//
18//#endif
19//
20//
21//#define __default_array_base_array_non_particle(TYPE) ::base_array_quantum < TYPE, const TYPE &, ::allocator::def < TYPE > >
22//
23//
24//#define DECLARE_TYPED_ARRAY_ACCESSOR_OF(ITEM, CONTAINER, TYPE, CONTAINER_TYPE) \
25//::pointer<TYPE>& ITEM ## _at(::collection::index i) { return CONTAINER[i]; } \
26//const TYPE * ITEM ## _at(::collection::index i) const { return CONTAINER[i]; } \
27//::pointer<TYPE>* ITEM ## _data() { return CONTAINER.data(); } \
28//::pointer<TYPE>const * ITEM ## _data() const { return CONTAINER.data(); } \
29//TYPE * get_ ## ITEM(::collection::index i) const { return CONTAINER.bounds(i) ? CONTAINER[i] : nullptr; } \
30//::collection::count ITEM ## _count() const { return CONTAINER.get_count(); } \
31//bool has_ ## ITEM() const { return CONTAINER.has_element(); } \
32//const CONTAINER_TYPE & ITEM ## a() const { return CONTAINER; } \
33//CONTAINER_TYPE & ITEM ## a() { return CONTAINER; } \
34//bool contains_ ## ITEM(const TYPE * p) const { return CONTAINER.contains(p); } \
35//bool is_there_no_ ## ITEM() const { return CONTAINER.is_empty(); } \
36//bool has_no_ ## ITEM() const { return is_there_no_ ## ITEM(); } \
37//::collection::index find_first_ ## ITEM(const TYPE * p, ::collection::index iStart = 0, ::collection::count nCount = -1) const { return CONTAINER.find_first(p, iStart, nCount); } \
38//::pointer<TYPE>& first_ ## ITEM() { return CONTAINER.first_pointer(); } \
39//::pointer<TYPE>& last_ ## ITEM() { return CONTAINER.last_pointer(); } \
40//TYPE * get_first_ ## ITEM() const { return CONTAINER.get_first_pointer(); } \
41//TYPE * get_last_ ## ITEM() const { return CONTAINER.get_last_pointer(); } \
42//::collection::index ITEM ## _first_index(::collection::index i = 0) const { return CONTAINER.first_index(i); } \
43//::collection::index ITEM ## _last_index(::collection::index i = -1) const { return CONTAINER.last_index(i); } \
44//CONTAINER_TYPE CONTAINER
45//
46//#define DECLARE_ARRAY_ACCESSOR_OF(ITEM, CONTAINER, TYPE) \
47//DECLARE_TYPED_ARRAY_ACCESSOR_OF(ITEM, CONTAINER, TYPE, pointer_array < TYPE >)
48//
49//#define DECLARE_TYPED_ARRAY_OF(ITEM, CONTAINER, TYPE, CONTAINER_TYPE) \
50//::collection::index add_ ## ITEM(TYPE * p) { return CONTAINER.add_item(p); } \
51//::collection::index add_ ## ITEM ## _array(const CONTAINER_TYPE & a) { return CONTAINER.append(a); } \
52//::collection::index add_unique_ ## ITEM(TYPE * p) { return CONTAINER.add_unique(p); } \
53//::collection::index add_unique_ ## ITEM ## _array(const CONTAINER_TYPE & a) { return CONTAINER.add_unique(a); } \
54//::collection::index erase_ ## ITEM(TYPE * p) { return CONTAINER.erase(p); } \
55//CONTAINER_TYPE ITEM ## a_section(::collection::index iStart = 0, ::collection::count nCount = -1){return CONTAINER.slice < CONTAINER_TYPE >(iStart, nCount);} \
56//template < typename ARRAY > \
57//void ITEM ## a_slice(ARRAY & a, ::collection::index iStart = 0, ::collection::count nCount = -1){ CONTAINER.slice(a, iStart, nCount);} \
58//DECLARE_TYPED_ARRAY_ACCESSOR_OF(ITEM, CONTAINER, TYPE, CONTAINER_TYPE)
59//
60//#define HAVE_ARRAY_OF(ITEM, CONTAINER, TYPE) \
61//DECLARE_TYPED_ARRAY_OF(ITEM, CONTAINER, TYPE, pointer_array < TYPE >)
62//
63//#define DECLARE_ARRAY_CONTAINER_OF(ARRAY, ITEM, CONTAINER, TYPE) \
64//ARRAY(const ::std::initializer_list < ::pointer<TYPE >>& list_base) : CONTAINER(list_base) { } \
65//DECLARE_TYPED_ARRAY_OF(ITEM, CONTAINER, TYPE, pointer_array < TYPE >)
66//
67//#define DECLARE_ARRAY_OF(ARRAY, ITEM, TYPE) \
68//DECLARE_ARRAY_CONTAINER_OF(ARRAY, ITEM, m_ ## ITEM ## a, TYPE)
69//
70//template < typename TYPE >
71//class pointer_rear_iterator
72//{
73//public:
74//
75//
76// using ITEM = non_const < TYPE >;
77// using ITEM_POINTER = ITEM *;
78//
79// using iterator = ::pointer_rear_iterator < ITEM >;
80// using const_iterator = ::pointer_rear_iterator < const ITEM >;
81//
82//
83// TYPE* m_p;
84//
85//
86// pointer_rear_iterator() { m_p = nullptr; }
87// pointer_rear_iterator(const ITEM * p) { m_p = (TYPE *) p; }
88// pointer_rear_iterator(const iterator & i) { m_p = (TYPE *)i.m_p; }
89// pointer_rear_iterator(const const_iterator & i) { m_p = (TYPE *)i.m_p; }
90//
91//
92// auto& operator *() { return *m_p; }
93// auto& operator *() const { return *m_p; }
94// auto operator ->() { return m_p; }
95// auto operator ->() const { return m_p; }
96//
97// pointer_rear_iterator & operator ++()
98// {
99// m_p--;
100// return *this;
101//
102// }
103// pointer_rear_iterator& operator --()
104// {
105// m_p++;
106// return *this;
107//
108// }
109//
110// pointer_rear_iterator operator ++(::i32)
111// {
112// auto p = *this;
113// m_p--;
114//
115// return p;
116//
117// }
118// pointer_rear_iterator operator --(::i32)
119// {
120// auto p = *this;
121// m_p++;
122//
123// return p;
124//
125// }
126// template < prototype_integral INTEGRAL >
127// pointer_rear_iterator operator +(INTEGRAL i)
128// {
129//
130// return m_p - i;
131//
132// }
133// template < prototype_integral INTEGRAL >
134// pointer_rear_iterator operator -(INTEGRAL i)
135// {
136//
137// return m_p + i;
138//
139// }
140//
141// template < prototype_integral INTEGRAL >
142// pointer_rear_iterator & operator +=(INTEGRAL i)
143// {
144// m_p -= i;
145// return *this;
146//
147// }
148// template < prototype_integral INTEGRAL >
149// pointer_rear_iterator & operator -=(INTEGRAL i)
150// {
151// m_p += i;
152// return *this;
153//
154// }
155//
156//
157// bool operator ==(const pointer_rear_iterator& p) const { return m_p == p.m_p; }
158// bool operator ==(const TYPE * p) const { return m_p == p; }
159// ::std::strong_ordering operator <=>(const pointer_rear_iterator& p) const { return this->m_p <=> p.m_p; }
160//
161// ::collection::count operator - (const pointer_rear_iterator& p) const { return this->m_p - p.m_p; }
162//
163//};
164//
165//
166//template < typename A, typename B >
167//auto distance(const pointer_rear_iterator < A > & a, const pointer_rear_iterator < B > & b) { return (a < b) ? (b - a) : (a - b); }
168//template < typename A, typename B >
169//auto distance(const A * pa, const B * pb) { return (pa < pb) ? (pb - pa) : (pa - pb); }
170//
171//
175//template < class TYPE, class ARG_TYPE, class TYPED, class MEMORY, ::enum_type t_etypeContainer >
176//class base_array_quantum :
177// //virtual public ::particle,
178// //public ::array_range < ::range < TYPE * > >
179// public ::range < TYPE * >,
180// public TYPED,
181// public MEMORY
182//{
183//public:
184//
185//
186// using rear_iterator = ::pointer_rear_iterator<TYPE>;
187// using const_rear_iterator = ::pointer_rear_iterator<const TYPE>;
188//
189// //using ARRAY_RANGE = ::array_range < ::range < TYPE * > >;
190// using ARRAY_RANGE = ::range < TYPE * >;
191// using array_range = ::range < TYPE * >;
192//
193// using PRIMITIVE_CONTAINER_TAG = PRIMITIVE_CONTAINER_TAG_TYPE;
194//
195// using CONTAINER_ITEM_TYPE = TYPE;
196// using TYPE_IS_PTR = TYPE;
197//
198// using this_iterator = typename ARRAY_RANGE::this_iterator;
199// using iterator = typename ARRAY_RANGE::iterator;
200// using const_iterator = typename ARRAY_RANGE::const_iterator;
201//
202//
203// ::collection::count m_countAllocation;
204// ::collection::count m_countAddUp;
205//
206//
207// base_array_quantum();
208// base_array_quantum(std::initializer_list < TYPE > initializer_list);
209// base_array_quantum(const base_array_quantum & a);
210// base_array_quantum(base_array_quantum && a) noexcept;
211// base_array_quantum(const TYPE * p, ::collection::count c);
212// base_array_quantum(::range < const_iterator > constrange) : base_array_quantum(constrange.begin(), constrange.end()) {}
213// template < prototype_integral INTEGRAL >
214// base_array_quantum(const_iterator begin, INTEGRAL count) : base_array_quantum(begin, begin + count) {}
215// base_array_quantum(const_iterator begin, const_iterator end)
216// {
217// auto p = this->begin();
218// while (p != end) add(*p);
219// }
220// virtual ~base_array_quantum();
221//
222//
223// void defer_destroy()
224// {
225//
226// if (this->m_begin != nullptr)
227// {
228//
229// destroy();
230//
231// }
232//
233// }
234//
235//
236// base_array_quantum & operator = (const base_array_quantum & a)
237// {
238//
239// if (this != &a)
240// {
241//
242// auto c = a.size();
243//
244// set_size(c);
245//
246// auto ptarget = this->data();
247//
248// auto psource = a.data();
249//
250// while(c > 0)
251// {
252//
253// *ptarget = *psource;
254//
255// ptarget++;
256//
257// psource++;
258//
259// c--;
260//
261// }
262//
263// }
264//
265// return *this;
266//
267// }
268//
269//
270// base_array_quantum & operator = (base_array_quantum && base_array_quantum)
271// {
272//
273// if (this != &base_array_quantum)
274// {
275//
276// transfer(::transfer(base_array_quantum));
277//
278// }
279//
280// return *this;
281//
282// }
283//
284//
285//
286// void add_initializer_list(const ::std::initializer_list < TYPE > & initializer_list)
287// {
288//
289// for (auto & item : initializer_list)
290// {
291//
292// add_item(item);
293//
294// }
295//
296// }
297//
298//
299// inline base_array_quantum & transfer(base_array_quantum && a)
300// {
301//
302// if (this != &a)
303// {
304//
305// destroy();
306//
307// ARRAY_RANGE::operator=(::transfer(a));
308//
309// m_countAddUp = a.m_countAddUp;
310//
311// m_countAllocation = a.m_countAllocation;
312//
313// }
314//
315// return *this;
316//
317// }
318//
319//
320// inline ::range<rear_iterator> rear_payloads()
321// {
322//
323// return ::range<rear_iterator>(this->rear_begin(), this->rear_end());
324//
325// }
326//
327//
328// inline ::range<const_rear_iterator> rear_payloads() const
329// {
330//
331// return ::range<const_rear_iterator>(this->rear_begin(), this->rear_end());
332//
333// }
334//
335// //template < typename iterator >
336// //struct make_iterator : iterator
337// //{
338//
339// // using CONTAINER = typename iterator::CONTAINER;
340//
341//
342// // make_iterator()
343// // {
344// // this->m_pelementBeg = (TYPE *)nullptr;
345// // this->m_pelementEnd = (TYPE *)nullptr;
346// // this->m_pcontainer = (CONTAINER *)nullptr;
347// // this->m_pelement = this->m_pelementBeg;
348// // }
349//
350// // make_iterator(::collection::index iStart, ::collection::index iEnd, const CONTAINER * parray = nullptr)
351// // {
352// // this->m_pelementBeg = (TYPE *)(parray->m_begin + iStart);
353// // this->m_pelementEnd = (TYPE *)(parray->m_begin + (iEnd < 0 ? parray->size() + iEnd + 1 : iEnd));
354// // this->m_pcontainer = (CONTAINER *)parray;
355// // this->m_pelement = this->m_pelementBeg;
356// // }
357//
358// // make_iterator(const CONTAINER * parray, const TYPE * pmatter = nullptr, const TYPE * pelementEnd = nullptr)
359// // {
360// // this->m_pelementBeg = (TYPE *)pmatter;
361// // this->m_pelementEnd = (TYPE *)pelementEnd;
362// // this->m_pcontainer = (CONTAINER *)parray;
363// // this->m_pelement = this->m_pelementBeg;
364// // }
365//
366//
367// // make_iterator(const make_iterator & iterator)
368// // {
369// // this->m_pelementBeg = (TYPE *)iterator.m_pelementBeg;
370// // this->m_pelementEnd = (TYPE *)iterator.m_pelementEnd;
371// // this->m_pelement = iterator.m_pelement;
372// // this->m_pcontainer = iterator.m_pcontainer;
373// // }
374//
375//
376// // make_iterator begin()
377// // {
378//
379// // return make_iterator(this->m_pcontainer, this->m_pelementBeg, this->m_pelementEnd);
380//
381// // }
382//
383//
384// // make_iterator end()
385// // {
386//
387// // return make_iterator(this->m_pcontainer, this->m_pelementEnd, this->m_pelementEnd);
388//
389// // }
390//
391//
392// // make_iterator & operator ++ ()
393// // {
394//
395// // this->m_pelement++;
396// // return *this;
397//
398// // }
399//
400//
401// // make_iterator operator ++ (::i32)
402// // {
403//
404// // auto it = *this;
405//
406// // this->m_pelement++;
407// // return it;
408//
409// // }
410//
411//
412// // make_iterator operator + (::collection::count c) const
413// // {
414//
415// // return { this->m_pcontainer, this->m_pelement + c };
416//
417// // }
418//
419//
420// // make_iterator operator - (const make_iterator & it) const
421// // {
422//
423// // return { this->m_pcontainer, this->m_pelement - it.index() };
424//
425// // }
426//
427//
428// // bool operator == (const make_iterator & it) const
429// // {
430//
431//
432// // if (this->m_pcontainer != it.m_pcontainer)
433// // {
434//
435// // return false;
436//
437// // }
438//
439// // return this->m_pelement == it.m_pelement;
440//
441// // }
442//
443//
444// // bool operator >= (const make_iterator & it) const
445// // {
446//
447//
448// // if (this->m_pcontainer != it.m_pcontainer)
449// // {
450//
451// // return false;
452//
453// // }
454//
455// // return this->m_pelement >= it.m_pelement;
456//
457// // }
458//
459//
460// // bool operator > (const make_iterator & it) const
461// // {
462//
463// // if (this->m_pcontainer != it.m_pcontainer)
464// // {
465//
466// // return false;
467//
468// // }
469//
470// // return this->m_pelement > it.m_pelement;
471//
472// // }
473//
474//
475// // bool operator != (const make_iterator & it) const
476// // {
477//
478// // if (this->m_pcontainer != it.m_pcontainer)
479// // {
480//
481// // return true;
482//
483// // }
484//
485// // return this->m_pelement != it.m_pelement;
486//
487// // }
488//
489// // bool operator < (const make_iterator & it) const
490// // {
491//
492// // if (this->m_pcontainer != it.m_pcontainer)
493// // {
494//
495// // return false;
496//
497// // }
498//
499// // return this->m_pelement < it.m_pelement;
500//
501//
502// // }
503//
504// // bool operator <= (const make_iterator & it) const
505// // {
506//
507// // if (this->m_pcontainer != it.m_pcontainer)
508// // {
509//
510// // return false;
511//
512// // }
513//
514// // return this->m_pelement <= it.m_pelement;
515//
516//
517// // }
518//
519//
520// // bool operator == (const TYPE * pmatter) const
521// // {
522//
523//
524// // if (!this->m_pcontainer->contains(pmatter))
525// // {
526//
527// // return false;
528//
529// // }
530//
531// // return this->m_pelement == pmatter;
532//
533// // }
534//
535//
536// // bool operator >= (const TYPE * pmatter) const
537// // {
538//
539//
540// // if (!this->m_pcontainer->contains(pmatter))
541// // {
542//
543// // return false;
544//
545// // }
546//
547// // return this->m_pelement >= pmatter;
548//
549// // }
550//
551//
552// // bool operator > (const TYPE * pmatter) const
553// // {
554//
555// // if (!this->m_pcontainer->contains(pmatter))
556// // {
557//
558// // return false;
559//
560// // }
561//
562// // return this->m_pelement > pmatter;
563//
564// // }
565//
566//
567// // bool operator != (const TYPE * pmatter) const
568// // {
569//
570// // if (!this->m_pcontainer->contains(pmatter))
571// // {
572//
573// // return true;
574//
575// // }
576//
577// // return this->m_pelement != pmatter;
578//
579// // }
580//
581// // bool operator < (const TYPE * pmatter) const
582// // {
583//
584// // if (!this->m_pcontainer->contains(pmatter))
585// // {
586//
587// // return false;
588//
589// // }
590//
591// // return this->m_pelement < pmatter;
592//
593//
594// // }
595//
596// // bool operator <= (const TYPE * pmatter) const
597// // {
598//
599// // if (!this->m_pcontainer->contains(pmatter))
600// // {
601//
602// // return false;
603//
604// // }
605//
606// // return this->m_pelement <= pmatter;
607//
608//
609// // }
610//
611// // make_iterator & operator = (const make_iterator & it)
612// // {
613//
614// // if (this != &it)
615// // {
616//
617// // this->m_pcontainer = it.m_pcontainer;
618//
619// // this->m_pelement = it.m_pelement;
620//
621// // }
622//
623// // return *this;
624//
625// // }
626//
627// // ::collection::index index() const { return this->m_pelement - this->m_pcontainer->m_begin; }
628//
629// //};
630//
631// //__declare_iterator(iterator, this->m_pelement);
632// //__declare_iterator(ref_iterator, *this->m_pelement);
633//
634// void this_is_a_container() {}
635//
636// //enum_type get_payload_type() const override { return t_etypeContainer; }
637//
638//
639// inline memsize length_in_bytes() const { return this->size() * sizeof(TYPE); }
640//
641// //inline auto values(::collection::index iStart = 0, ::collection::index iEnd = -1) const { return iterator(iStart, iEnd, this); }
642//
643//
644// //inline iterator begin()
645// //{
646//
647// // return iterator(0, (::collection::index)this->size(), this);
648//
649// //}
650//
651//
652// //inline iterator end()
653// //{
654//
655// // return iterator((::collection::index)this->size(), (::collection::index)this->size(), this);
656//
657// //}
658//
659// //inline const TYPE * get_data() const { return this->begin(); }
660// //inline TYPE * get_data() { return this->begin(); }
661// inline bool contains_address(const TYPE * pmatter) const { return pmatter >= this->m_begin && pmatter < this->end(); }
662//
663//
664// inline ::collection::count get_size() const;
665// inline ::collection::count get_size_in_bytes() const;
666// inline ::collection::count get_count() const;
667// inline ::collection::count get_byte_count() const;
668// inline ::collection::count get_length() const;
669// //inline ::collection::count size() const;
670// inline ::collection::count count() const;
671// inline ::collection::count length() const;
672// inline ::collection::count byte_count() const { return get_byte_count(); }
673//
674//
675// inline bool has_element() const noexcept { return this->size() > 0; }
676// inline bool is_empty(::collection::count countMinimum = 0) const noexcept { return this->size() <= countMinimum; }
677// inline bool empty(::collection::count countMinimum = 0) const noexcept { return this->size() <= countMinimum; }
678// inline bool has_elements(::collection::count countMinimum = 1) const noexcept { return this->size() >= countMinimum; }
679// inline ::collection::index get_lower_bound(::collection::index i = 0) const;
680// inline ::collection::index get_middle_index(::collection::index i = 0) const;
681// inline ::collection::index get_upper_bound(::collection::index i = -1) const;
682// inline ::collection::index lower_bound(::collection::index i = 0) const { return this->get_lower_bound(i); }
683// inline ::collection::index upper_bound(::collection::index i = -1) const { return this->get_upper_bound(i); }
684// inline ::collection::index first_index(::collection::index i = 0) const { return this->lower_bound(i); }
685// inline ::collection::index middle_index(::collection::index i = 0) const { return this->get_middle_index(i); }
686// inline ::collection::index last_index(::collection::index i = -1) const { return this->get_upper_bound(i); }
687// inline bool bounds(::collection::index i) const;
688// inline bool contains_index(::collection::index i) const { return bounds(i); }
689//
690//
691// inline this_iterator back(::collection::index i = -1) { return (this_iterator)(this->begin() + this->get_upper_bound(i)); }
692// inline const_iterator back(::collection::index i = -1) const { return (const_iterator)(this->begin() + this->get_upper_bound(i)); }
693//
694// void ensure_index_ok(::collection::index nIndex) const { if (nIndex < 0 || nIndex >= this->size()) throw_exception(error_index_out_of_bounds); }
695//
696// inline const TYPE * ptr_at(::collection::index nIndex) const { return this->m_begin + nIndex; }
697// inline TYPE * ptr_at(::collection::index nIndex) { return this->m_begin + nIndex; }
698//
699// inline const TYPE & element_at(::collection::index nIndex) const;
700// inline TYPE & element_at(::collection::index nIndex);
701//
702// inline const TYPE& at(::collection::index nIndex) const { ensure_index_ok(nIndex); return element_at(nIndex); }
703// inline TYPE& at(::collection::index nIndex) { ensure_index_ok(nIndex); return element_at(nIndex); }
704//
705// inline TYPE & first(::collection::index n = 0);
706// inline const TYPE & first(::collection::index n = 0) const;
707//
708// inline TYPE & last(::collection::index n = -1);
709// inline const TYPE & last(::collection::index n = -1) const;
710//
711// inline TYPE & middle(::collection::index n = 0);
712// inline const TYPE & middle(::collection::index n = 0) const;
713//
714// inline void set_at_grow(::collection::index nIndex, ARG_TYPE newElement);
715// inline TYPE & element_at_grow(::collection::index nIndex);
716//
717// inline void set_each(ARG_TYPE element, ::collection::index iStart = 0, ::collection::count c = -1);
718//
719// template < ::std::size_t N >
720// TYPE & get() { return element_at(N); }
721//
722//
723// void reserve(::collection::count newAllocationSize);
724//
725//
726// ::collection::count set_size(::collection::count nNewSize);
727//
728//
729// //::collection::count set_size(::collection::count nNewSize, ::collection::count nGrowBy = -1); // does not call default constructors on ___new items/elements
730//
731// /// if bRaw is true does not call default constructors on ___new elements
732// template < pointer_not_castable_to < TYPE * > P >
733// ::collection::count allocate(::collection::count nNewSize, bool bShrink, bool bRaw, P & p)
734// {
735// TYPE t(p);
736// return _allocate(nNewSize, bShrink, bRaw, &t);
737// }
738// template < pointer_castable_to < TYPE * > T >
739// ::collection::count allocate(::collection::count nNewSize, bool bShrink, bool bRaw, T & t)
740// {
741// return _allocate(nNewSize, bShrink, bRaw, &t);
742// }
743// ::collection::count allocate(::collection::count nNewSize, bool bShrink, bool bRaw)
744// {
745// return _allocate(nNewSize, bShrink, bRaw, nullptr);
746// }
747// ::collection::count _allocate(::collection::count nNewSize, bool bShrink, bool bRaw, const TYPE * type);
748//
749// //::collection::count allocate(::collection::count nNewSize, bool bShrink, const TYPE * ptype = nullptr);
750//
751// ::collection::count allocate_in_bytes(::collection::count nNewSize, bool bShrink, bool bRaw);
752//
754//
755// ::collection::count resize(::collection::count nNewSize) { return set_size(nNewSize); }
756// ::collection::count resize(::collection::count nNewSize, ARG_TYPE t);
757//
758// void free_extra();
759// virtual void destroy();
760//
761// inline void __swap(::collection::index index1, ::collection::index index2);
762// inline void __swap(iterator index1, iterator index2);
763// inline void __swap(const_iterator index1, const_iterator index2);
764//
765//
766// void set_all(const TYPE & t);
767//
768//
769// rear_iterator rear_begin()
770// {
771// return this->m_end - 1;
772// }
773//
774// rear_iterator rear_end()
775// {
776// return this->m_begin - 1;
777// }
778//
779// const_rear_iterator rear_begin() const
780// {
781// return (const_rear_iterator&)this->m_end - 1;
782// }
783//
784// const_rear_iterator rear_end() const
785// {
786// return (const_rear_iterator&)this->m_begin - 1;
787// }
788//
789//
790// void zero(::collection::index iStart = 0, ::collection::count c = -1);
791//
792// //template < prototype_array ARRAY >
793// //void _001RemoveIndexes(ARRAY & ia);
794//
795// template < prototype_array ARRAY >
796// void erase_indexes(const ARRAY & ia);
797//
798// template < prototype_array ARRAY >
799// void erase_descending_indexes(const ARRAY & ia);
800//
801//
802// inline bool prepare_first_last(::collection::index & first, ::collection::index & last) const;
803// inline bool prepare_first_in_count_last_out(::collection::index & first, ::collection::count & inCountLastOut) const;
804//
805//
806// inline void erase_last();
807// inline ::collection::count erase_all();
808// inline void clear();
809//
810//
811// void on_construct_element(TYPE * p) { TYPED::construct(p); }
812// void on_construct_element(TYPE * p, ::collection::count c) { TYPED::construct_count(p, c); }
813// void on_destruct_element(TYPE * p) { TYPED::destruct(p); }
814// void on_copy_element(::collection::index i, const TYPE * p) { TYPED::copy(&this->m_begin[i], p); }
815//
816//
817// // FISC - Flaw in some compiler
818// //inline operator TYPE *() { return this->m_begin; }
819// //inline operator const TYPE *() const { return this->m_begin; }
820//
821//
822// inline const TYPE & operator[](::collection::index i) const { return this->m_begin[i]; }
823// inline TYPE & operator[](::collection::index i) { return this->m_begin[i]; }
824//
825//
826// TYPE * raw_allocate_at(::collection::index i, ::collection::count c);
827//
828//
829// TYPE & insert_at(::collection::index nIndex, const TYPE & newElement, ::collection::count nCount = 1);
830// TYPE * insert_at(::collection::index nStartIndex, const TYPE * p, ::collection::count nCount = 1);
831//
832// TYPE * insert_array_at(::collection::index nStartIndex, const base_array_quantum * pNewArray);
833//
834//
835// ::collection::index erase_at(::collection::index nIndex, ::collection::count nCount = 1);
836//
837// //::collection::index allocate_at(::collection::index nIndex, ::collection::count nCount = 1);
838//
839//
840// TYPE pick_at(::collection::index nIndex);
841// TYPE pick_first(::collection::index nIndex = 0) { return ::transfer(pick_at(nIndex)); }
842// TYPE pick_last(::collection::index nIndex = -1) { return ::transfer(pick_at(this->size() + nIndex)); }
843// base_array_quantum pick_at(::collection::index nIndex, ::collection::count nCount);
844//
845//
846// ::collection::index erase_item(TYPE * p);
847//
848// ::collection::index index_of(const TYPE * p) const { auto i = p - this->m_begin; return i >= 0 && i < this->size() ? i : -1; }
849//
850//
851// bool erase(const TYPE * p) { auto i = index_of(p); if (not_found(i)) return false; return found(erase_at(i)); }
852// ::collection::count erase(const TYPE * begin, const TYPE * end);
853//
854// iterator erase(iterator p)
855// {
856//
857// this->erase_at(index_of(p));
858//
859// return p;
860//
861// }
862//
863// template < typename ITERATOR2 >
864// inline void erase(const ITERATOR2 & begin, const ITERATOR2 & last);
865//
866//
867// inline TYPE pop(::collection::index i = -1);
868// inline ::collection::index push(ARG_TYPE newElement);
869// inline void pop_back(::collection::index i = -1);
870// inline TYPE & add_item(ARG_TYPE newElement);
871// inline TYPE & add(ARG_TYPE newElement) { return this->add_item(newElement); }
872// inline TYPE& add_new();
873//
874//
875// inline TYPE pop_first(::collection::index i = 0);
876//
877// inline TYPE takeAt(::collection::index i);
878// inline TYPE takeFirst(::collection::index i = 0);
879// inline TYPE takeLast(::collection::index i = -1);
880//
881// virtual ::collection::count append(const base_array_quantum & src); // return old i32_size
882// virtual void copy(const base_array_quantum & src);
883//
884//
885// template < prototype_container CONTAINER >
886// ::collection::count append(const CONTAINER & container)
887// {
888//
889// ::collection::count c = 0;
890//
891// for (auto& item : container)
892// {
893//
894// add(item);
895//
896// c++;
897//
898// }
899//
900// return c;
901//
902// }
903//
904//
905//
906// virtual void on_after_read();
907//
908// template < typename PRED >
909// ::collection::count predicate_each(PRED pred, ::collection::index iStart = 0, ::collection::count c = -1)
910// {
911//
912// ::collection::index iEnd = c < 0 ? get_count() + c : iStart + c - 1;
913//
914// ::i32 cProcessed = 0;
915//
916// for (::collection::index i = iStart; i <= iEnd; i++)
917// {
918//
919// pred(this->m_begin[i]);
920//
921// cProcessed++;
922//
923// }
924//
925// return cProcessed;
926//
927// }
928//
929// template < typename PRED >
930// ::collection::count predicate_each(PRED pred, ::collection::index iStart = 0, ::collection::count c = -1) const
931// {
932//
933// return ((base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >*)this)->predicate_each(pred, iStart, c);
934//
935// }
936//
937//
938// inline bool is_index_ok(::collection::index iIndex) const { return iIndex >= 0 && iIndex < get_count(); }
939//
940//
941// inline bool is_last_index(::collection::index iIndex) const { return iIndex >= get_upper_bound(); }
942//
943//
944// template < typename PRED >
945// bool predicate_contains(PRED pred, ::collection::index iStart = 0, ::collection::index iEnd = -1) const
946// {
947//
948// return this->predicate_find_first(pred, iStart, iEnd) >= 0;
949//
950// }
951//
952// template < typename OTHER_IS_PTR >
953// TYPE_IS_PTR get_existing_defer_add(const OTHER_IS_PTR & p)
954// {
955//
956// for (::collection::index i = 0; i < this->get_count(); i++)
957// {
958//
959// auto & pelementHere = this->element_at(i);
960//
961// if (pelementHere == p)
962// {
963//
964// return pelementHere;
965//
966// }
967// else if (*pelementHere == *p)
968// {
969//
970// return pelementHere;
971//
972// }
973//
974// }
975//
976// this->add(p);
977//
978// return p;
979//
980// }
981//
982//
983// template < typename OTHER_IS_PTR >
984// void defer_use_existing(OTHER_IS_PTR & p)
985// {
986//
987// for (::collection::index i = 0; i < this->get_count(); i++)
988// {
989//
990// auto & pelementHere = this->element_at(i);
991//
992// if (pelementHere == p)
993// {
994//
995// return;
996//
997// }
998// else if (*pelementHere == *p)
999// {
1000//
1001// p = pelementHere;
1002//
1003// return;
1004//
1005// }
1006//
1007// }
1008//
1009// this->add(p);
1010//
1011// }
1012//
1013//
1014// template < typename OTHER_IS_PTR >
1015// TYPE_IS_PTR get_existing(const OTHER_IS_PTR & p) const
1016// {
1017//
1018// for (::collection::index i = 0; i < this->get_count(); i++)
1019// {
1020//
1021// auto & pelementHere = this->element_at(i);
1022//
1023// if (pelementHere == p)
1024// {
1025//
1026// return pelementHere;
1027//
1028// }
1029// else if (*pelementHere == *p)
1030// {
1031//
1032// return pelementHere;
1033//
1034// }
1035//
1036// }
1037//
1038// return p;
1039//
1040// }
1041//
1042//
1043// template < typename OBJECT, typename ATTRIBUTE >
1044// TYPE_IS_PTR merge_get_existing(const TYPE_IS_PTR & p, const OBJECT& pparticle, const ATTRIBUTE& attribute)
1045// {
1046//
1047// auto pModified = __call_.hold << ___new typename TYPE_IS_PTR::TYPE (*p);
1048//
1049// pModified->process(pparticle, attribute);
1050//
1051// return this->get_existing(pModified);
1052//
1053// }
1054//
1055//
1056// template < typename PRED >
1057// ::collection::index predicate_find_first(PRED pred, ::collection::index iStart = 0, ::collection::index iEnd = -1) const
1058// {
1059//
1060// if (iEnd < 0)
1061// {
1062//
1063// iEnd += get_count();
1064//
1065// }
1066//
1067// if (iEnd >= get_count())
1068// {
1069//
1070// iEnd = get_count() - 1;
1071//
1072// }
1073//
1074// for (::collection::index i = iStart; i <= iEnd; i++)
1075// {
1076//
1077// if (pred(this->m_begin[i]))
1078// {
1079//
1080// return i;
1081//
1082// }
1083//
1084// }
1085//
1086// return -1;
1087//
1088// }
1089//
1090//
1091// template < typename PRED >
1092// ::collection::index predicate_find_last(PRED pred, ::collection::index iLast = -1)
1093// {
1094//
1095// if (iLast < 0)
1096// {
1097//
1098// iLast += get_count();
1099//
1100// }
1101//
1102// for (::collection::index i = iLast; i >= 0; i--)
1103// {
1104//
1105// if (pred(this->m_begin[i]))
1106// {
1107//
1108// return i;
1109//
1110// }
1111//
1112// }
1113//
1114// return -1;
1115//
1116// }
1117//
1118//
1119// template < typename PRED >
1120// TYPE * predicate_get_first(PRED pred)
1121// {
1122//
1123// for (::i32 i = 0; i < get_count(); i++)
1124// {
1125//
1126// if (pred(this->m_begin[i]))
1127// {
1128//
1129// return &element_at(i);
1130//
1131// }
1132//
1133// }
1134//
1135// return nullptr;
1136//
1137// }
1138//
1139//
1140// template < typename PRED >
1141// ::collection::count predicate_get_count(PRED pred)
1142// {
1143//
1144// ::collection::count c = 0;
1145//
1146// for (::i32 i = 0; i < get_count(); i++)
1147// {
1148//
1149// if (pred(this->m_begin[i]))
1150// {
1151//
1152// c++;
1153//
1154// }
1155//
1156// }
1157//
1158// return c;
1159//
1160// }
1161//
1162//
1163// template < typename PRED >
1164// ::collection::count predicate_erase(PRED pred)
1165// {
1166//
1167// ::collection::count cTotal = 0;
1168//
1169// for (::i32 i = 0; i < get_count();)
1170// {
1171//
1172// if (!pred(this->m_begin[i]))
1173// {
1174//
1175// i++;
1176//
1177// }
1178// else
1179// {
1180//
1181// ::i32 iStart = i;
1182//
1183// ::i32 iCount = 1;
1184//
1185// i++;
1186//
1187// for (; i < get_count();)
1188// {
1189//
1190// if (!pred(this->m_begin[i]))
1191// {
1192//
1193// break;
1194//
1195// }
1196//
1197// iCount++;
1198//
1199// i++;
1200//
1201// }
1202//
1203// erase_at(iStart, iCount);
1204//
1205// cTotal += iCount;
1206//
1207// i = iStart;
1208//
1209// }
1210//
1211// }
1212//
1213// return cTotal;
1214//
1215// }
1216//
1217//
1218// template < typename F >
1219// void each(F f)
1220// {
1221//
1222// for (::collection::index i = 0; i < get_count(); i++)
1223// {
1224//
1225// f(this->m_begin[i]);
1226//
1227// }
1228//
1229// }
1230//
1231//
1232// template < typename PRED >
1233// void predicate_sort(PRED pred);
1234//
1235//
1236// template < typename T, typename PRED >
1237// ::collection::index predicate_binary_search(const T & t, PRED pred) const;
1238//
1239//
1240// inline bool valid_iter(iterator first, iterator last)
1241// {
1242//
1243// return first < last;
1244//
1245// }
1246//
1247//
1248// inline bool rvalid_iter(iterator first, iterator last)
1249// {
1250//
1251// return first > last;
1252//
1253// }
1254//
1255//
1256// inline TYPE& operator%(::collection::index nIndex)
1257// {
1258//
1259// return this->element_at(nIndex% this->get_size());
1260//
1261// }
1262//
1263//
1264// inline const TYPE& operator%(::collection::index nIndex) const
1265// {
1266//
1267// return this->element_at(nIndex% this->get_size());
1268//
1269// }
1270//
1271//
1272// bool is_version(::collection::index i)
1273// {
1274//
1275// return true;
1276//
1277// //if (!m_pvarOptions)
1278// //{
1279//
1280// // return i <= 0;
1281//
1282// //}
1283//
1284// //return i <= options()["version"].as_i32();
1285//
1286// }
1287//
1288//
1289//};
1290
1291
1292#include "base_array_quantum.h"
1293#include "acme/prototype/prototype/particle.h"
1294
1295
1296template < class TYPE, class ARG_TYPE, class TYPED, class MEMORY, ::enum_type t_etypeContainer >
1297class base_array :
1298 virtual public ::particle,
1299 public base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >
1300{
1301public:
1302
1303
1304 using BASE_ARRAY = base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >;
1305
1306
1307 //base_array() : base_array_quantum< TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >() {}
1308 //template < typename ...Args >
1309 //base_array(Args&&... args) :
1310 // base_array_quantum< TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >(::std::forward < Args >(args)...)
1311 //{
1312 //}
1313
1314 base_array() {}
1315 base_array(std::initializer_list < TYPE > initializer_list) :BASE_ARRAY(initializer_list) {}
1316 base_array(const BASE_ARRAY & a) :BASE_ARRAY(a) {}
1317 base_array(BASE_ARRAY && a) noexcept :BASE_ARRAY(a) {}
1318 base_array(const TYPE * p, ::collection::count c) :BASE_ARRAY(p, c) {}
1319 base_array(::range < typename BASE_ARRAY::const_iterator > constrange) :
1320 BASE_ARRAY(constrange.begin(), constrange.end()) {}
1321 template < prototype_integral INTEGRAL >
1322 base_array(typename BASE_ARRAY::const_iterator begin, INTEGRAL count) :
1323 BASE_ARRAY(begin, begin + count) {}
1324 base_array(typename BASE_ARRAY::const_iterator begin, typename BASE_ARRAY::const_iterator end)
1325 {
1326 auto p = this->begin();
1327 while (p != end) add(*p);
1328 }
1329
1330
1331 void destroy()
1332 {
1333
1334 particle::destroy();
1335
1336 BASE_ARRAY::destroy();
1337
1338 }
1339
1340
1341};
1342
1343
1344//template < prototype_integral INTEGRAL, class TYPE, class ARG_TYPE, class TYPED = ::typed::nodef < TYPE >, class MEMORY = ::heap::typed_memory < TYPE, ::heap::e_memory_array >, ::enum_type t_etypeContainer = e_type_element >
1345//inline TYPE& operator%(INTEGRAL nIndex, const base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & a)
1346//{
1347//
1348// return (TYPE &) (a % nIndex);
1349//
1350//}
1351//
1352//
1353//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1354//base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::base_array_quantum() :
1355//ARRAY_RANGE()
1356//{
1357//
1358// m_countAddUp = 0;
1359// m_countAllocation = 0;
1360//
1361//}
1362//
1363//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1364//base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::base_array_quantum(base_array_quantum && array) noexcept :
1365// ARRAY_RANGE(array)
1366//{
1367//
1368// this->m_countAddUp = array.m_countAddUp;
1369// this->m_countAllocation = array.m_countAllocation;
1370//
1371// array.m_begin = nullptr;
1372// array.m_end = 0;
1373// array.m_countAllocation = 0;
1374//
1375//}
1376//
1377//
1378//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1379//base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::base_array_quantum(std::initializer_list<TYPE > initializer_list) :
1380// base_array_quantum()
1381//{
1382//
1383// for (auto & item : initializer_list)
1384// {
1385//
1386// add(item);
1387//
1388// }
1389//
1390//}
1391//
1392//
1393//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1394//base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::base_array_quantum(const base_array_quantum & array)
1395//{
1396//
1397// m_countAddUp = 0;
1398// this->m_begin = nullptr;
1399// this->m_end = nullptr;
1400// m_countAllocation = 0;
1401//
1402// set_size(array.get_size());
1403//
1404// for (::collection::index i = 0; i < array.get_size(); i++)
1405// {
1406//
1407// element_at(i) = array[i];
1408//
1409// }
1410//
1411//}
1412//
1413//
1414//
1415//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1416//base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::~base_array_quantum ()
1417//{
1418//
1419// defer_destroy();
1420//
1421//}
1422//
1423//
1424//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1425//::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::resize(::collection::count nNewSize, ARG_TYPE t)
1426//{
1427//
1428// return allocate(nNewSize, false, false, t);
1429//
1430//}
1431//
1432//
1433//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1434//::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::allocate_in_bytes(::collection::count nNewSize, bool bShrink, bool bRaw)
1435//{
1436//
1437// return allocate((nNewSize + sizeof(TYPE)) / sizeof(TYPE), bShrink, bRaw);
1438//
1439//}
1440//
1441//
1442//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1443//::collection::index base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::erase_at(::collection::index first, ::collection::count in_count_out_last)
1444//{
1445//
1446// if (!prepare_first_in_count_last_out(first, in_count_out_last))
1447// {
1448//
1449// //throw_exception(error_bad_argument);
1450//
1451// return -1;
1452//
1453// }
1454//
1455// auto nCount = in_count_out_last - first + 1;
1456//
1457// ::collection::count nMoveCount = this->size() - in_count_out_last;
1458//
1459// TYPED::destruct_count(this->m_begin + first, nCount);
1460//
1461// if(nMoveCount)
1462// {
1463//
1464// ::safe_memory_transfer(this->m_begin + first, (size_t) nMoveCount * sizeof(TYPE), this->m_begin + in_count_out_last + 1, (size_t) nMoveCount * sizeof(TYPE));
1465//
1466// }
1467//
1468// this->m_end -= nCount;
1469//
1470// return first;
1471//
1472//}
1473//
1474//
1475//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1476//::collection::index base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::erase_item(TYPE * p)
1477//{
1478//
1479// return erase_at(p - this->m_begin);
1480//
1481//}
1482//
1483//
1484//
1485//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1486//void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::free_extra()
1487//{
1488//
1489// auto size = this->size();
1490//
1491// if(size != m_countAllocation)
1492// {
1493//
1494// // shrink to desired size
1495//
1496//#ifdef SIZE_T_MAX
1497//
1498// ASSERT(size <= SIZE_T_MAX / sizeof(TYPE)); // no overflow
1499//
1500//#endif
1501//
1502// TYPE* pNewData = nullptr;
1503//
1504// if(size != 0)
1505// {
1506//
1507// TYPE * pNewData;
1508//
1509//#if defined(__MCRTDBG) || MEMDLEAK
1510//
1511// #ifdef __MCRTDBG
1512//
1513// if (::get_task() != nullptr)
1514// {
1515//
1516// if (::get_task()->m_strFile.has_character())
1517// {
1518//
1519// pNewData = MEMORY::allocate(size, ::get_task()->m_strFile, ::get_task()->m_iLine);
1520//
1521// }
1522// else
1523// {
1524//
1525// pNewData = MEMORY::allocate(size, __FILE__, __LINE__);
1526//
1527// }
1528//
1529// }
1530// else
1531// {
1532//
1533// pNewData = MEMORY::allocate(size, __FILE__, __LINE__);
1534//
1535// }
1536//
1537//#else
1538//
1539// if (::get_task_object_debug().has_character())
1540// {
1541//
1542// pNewData = MEMORY::allocate(size, ::get_task_object_debug(), 0);
1543//
1544// }
1545// else
1546// {
1547//
1548// pNewData = MEMORY::allocate(size, __FILE__, __LINE__);
1549//
1550// }
1551//
1552//#endif
1553//
1554//#else
1555//
1556// pNewData = MEMORY::allocate(size);
1557//
1558//#endif
1559//
1560// // copy ___new data from old
1561// ::safe_memory_copy(pNewData, (size_t)size * sizeof(TYPE),this->m_begin, (size_t)size * sizeof(TYPE));
1562//
1563// }
1564//
1565// // get rid of old stuff (note: no destructors called)
1566// MEMORY::free(this->m_begin);
1567//
1568// this->m_begin = pNewData;
1569//
1570// m_countAllocation = size;
1571//
1572// this->m_end = this->m_begin + size;
1573//
1574// }
1575//
1576//}
1577//
1578//
1579//
1580//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1581//void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::destroy()
1582//{
1583//
1584// if(this->m_begin != nullptr)
1585// {
1586//
1587// auto size = this->size();
1588//
1589// TYPED::destruct_count(this->m_begin, size);
1590//
1591// MEMORY::free(this->m_begin);
1592//
1593// this->m_begin = nullptr;
1594// this->m_end = nullptr;
1595// m_countAllocation = 0;
1596//
1597// }
1598//
1599//}
1600//
1601//
1602//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1603//TYPE * base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::raw_allocate_at(::collection::index i, ::collection::count c)
1604//{
1605//
1606// auto newSize = this->size() + c;
1607//
1608// auto nMove = this->size() - i;
1609//
1610// this->allocate(newSize, false, true);
1611//
1612// ::safe_memory_transfer(this->m_begin + i + c, (size_t) (nMove * sizeof(TYPE)), this->m_begin + i, (size_t) (nMove * sizeof(TYPE)));
1613//
1614// return this->m_begin + i;
1615//
1616//}
1617//
1618//
1619//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1620//TYPE & base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::insert_at(::collection::index i, const TYPE & element, ::collection::count c)
1621//{
1622//
1623// auto p = this->raw_allocate_at(i, c);
1624//
1625// TYPED::copy_construct_count(p, c, element);
1626//
1627// return *p;
1628//
1629//}
1630//
1631//
1632//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1633//TYPE * base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::insert_at(::collection::index i, const TYPE * pelements, ::collection::count c)
1634//{
1635//
1636// auto p = this->raw_allocate_at(i, c);
1637//
1638// TYPED::copy_construct_count(p, c, pelements);
1639//
1640// return p;
1641//
1642//}
1643//
1644//
1645//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1646//TYPE * base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::insert_array_at(::collection::index i, const base_array_quantum * p)
1647//{
1648//
1649// return this->insert_at(i, p->m_begin, p->size());
1650//
1651//}
1652//
1653//
1703//
1704//
1705//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1706//::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::append(const base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & src)
1707//{
1708//
1709// ::collection::count nOldSize = this->size();
1710//
1711// ::collection::count nSrcSize = src.size(); // to enable to append to itself
1712//
1713// allocate(nOldSize + nSrcSize, false, true);
1714//
1715// TYPED::copy_construct_count((this->m_begin + nOldSize), nSrcSize, src.m_begin);
1716//
1717// return nOldSize;
1718//
1719//}
1720//
1721//
1722//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1723//void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::copy(const base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & src)
1724//{
1725//
1726// if(this == &src)
1727// {
1728//
1729// return;
1730//
1731// }
1732//
1733// erase_all();
1734//
1735// append(src);
1736//
1742//
1743//}
1744//
1745//
1759//
1761//
1762//
1763//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1764//template < prototype_array ARRAY >
1765//void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::erase_indexes(const ARRAY & ia)
1766//{
1767//
1768//
1769// // erase indexes
1770// for(::collection::index i = ia.get_upper_bound(); i >= 0; i--)
1771// {
1772//
1773// erase_at(ia[i]);
1774//
1775// }
1776//
1777//}
1778//
1779//
1780//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1781//template < prototype_array ARRAY >
1782//void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::erase_descending_indexes(const ARRAY & ia)
1783//{
1784//
1785// for(::collection::index i = 0; i < ia.get_count(); i++)
1786// {
1787//
1788// erase_at(ia[i]);
1789//
1790// }
1791//
1792//}
1793//
1794//
1795//
1855//
1856//
1857//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1858//TYPE base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::pick_at(::collection::index nIndex)
1859//{
1860//
1861// ::collection::count nCount = 1;
1862//
1863// ::collection::index nUpperBound = nIndex + nCount;
1864//
1865// if (nIndex < 0 || nCount < 0 || (nUpperBound > this->size()) || (nUpperBound < nIndex) || (nUpperBound < nCount))
1866// {
1867//
1868// throw_exception(error_bad_argument);
1869//
1870// }
1871//
1872// ::collection::count nMoveCount = this->size() - (nUpperBound);
1873//
1874// auto t = ::transfer(this->m_begin[nIndex]);
1875//
1876// //TYPED::destruct_count(this->m_begin + nIndex, nCount REFERENCING_DEBUGGING_COMMA_THIS);
1877//
1878// if (nMoveCount)
1879// {
1880//
1881// ::safe_memory_transfer(this->m_begin + nIndex, (size_t)nMoveCount * sizeof(TYPE), this->m_begin + nUpperBound, (size_t)nMoveCount * sizeof(TYPE));
1882//
1883// }
1884//
1885// this->m_end -= nCount;
1886//
1887// return ::transfer(t);
1888//
1889//}
1890//
1891//
1892//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
1893//base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::pick_at(::collection::index nIndex, ::collection::count nCount)
1894//{
1895//
1896// //ASSERT_OK(this);
1897//
1898// ::collection::index nUpperBound = nIndex + nCount;
1899//
1900// if (nIndex < 0 || nCount < 0 || (nUpperBound > this->size()) || (nUpperBound < nIndex) || (nUpperBound < nCount))
1901// {
1902//
1903// throw_exception(error_bad_argument);
1904//
1905// }
1906//
1907// ::collection::count nMoveCount = this->size() - (nUpperBound);
1908//
1909// base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > a(this->m_begin + nIndex, (size_t)nMoveCount);
1910//
1911// TYPED::destruct_count(this->m_begin + nIndex, nCount);
1912//
1913// if (nMoveCount)
1914// {
1915//
1916// ::safe_memory_transfer(this->m_begin + nIndex, (size_t)nMoveCount * sizeof(TYPE), this->m_begin + nUpperBound, (size_t)nMoveCount * sizeof(TYPE));
1917//
1918// }
1919//
1920// this->m_end -= nCount;
1921//
1922// return a;
1923//
1924//}
1925//
1926//
2116//
2117//
2118//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
2119//void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::reserve(::collection::count newAllocationSize)
2120//{
2121//
2122// if(newAllocationSize <= m_countAllocation)
2123// {
2124//
2125// return;
2126//
2127// }
2128//
2129// if(m_countAllocation <= 0)
2130// {
2131//
2132// ASSERT(this->m_begin == nullptr && this->m_end == nullptr);
2133//
2134// if(newAllocationSize > UPTR_MAXIMUM / sizeof(TYPE))
2135// {
2136//
2137// throw_exception(error_no_memory);
2138//
2139// }
2140//
2141// newAllocationSize = maximum(newAllocationSize, m_countAddUp);
2142//
2143//#if MEMDLEAK || defined(__MCRTDBG)
2144//
2145// if(::get_task() != nullptr)
2146// {
2147//
2148//#if defined(__MCRTDBG)
2149//
2150// if(::get_task()->m_strFile.has_character())
2151// {
2152//
2153// this->m_begin = MEMORY::allocate(newAllocationSize, ::get_task()->m_strFile, ::get_task()->m_iLine);
2154//
2155// }
2156// else
2157// {
2158//
2159// this->m_begin = MEMORY::allocate(newAllocationSize, __FILE__, __LINE__);
2160//
2161// }
2162//
2163//#else
2164//
2165// if (::get_task_object_debug().has_character())
2166// {
2167//
2168// this->m_begin = MEMORY::allocate(newAllocationSize, "thread://" + ::get_task_object_name() + ", " + ::get_task_object_debug() + ", " + string(__FILE__), __LINE__);
2169//
2170// }
2171// else
2172// {
2173//
2174// this->m_begin = MEMORY::allocate(newAllocationSize, "thread://" + ::get_task_object_name() + ", " + string(__FILE__), __LINE__);
2175//
2176// }
2177//
2178//#endif
2179//
2180// }
2181// else
2182// {
2183//
2184// this->m_begin = MEMORY::allocate(newAllocationSize, __FILE__, __LINE__);
2185//
2186// }
2187//
2188//#else
2189//
2190// this->m_begin = MEMORY::allocate(newAllocationSize);
2191//
2192//#endif
2193//
2194// this->m_end = this->m_begin;
2195//
2196// }
2197// else
2198// {
2199//
2200// auto countOld = this->size();
2201//
2202// auto countAddUp = m_countAddUp;
2203//
2204// if(countAddUp <= 0)
2205// {
2206//
2207// countAddUp = this->size();
2208//
2209// constrain(countAddUp, 4, 1024);
2210//
2211// }
2212//
2213// if(newAllocationSize < m_countAllocation + countAddUp)
2214// {
2215//
2216// newAllocationSize = m_countAllocation + countAddUp;
2217//
2218// }
2219//
2220// if(newAllocationSize > UPTR_MAXIMUM / sizeof(TYPE))
2221// {
2222//
2223// throw_exception(error_no_memory);
2224//
2225// }
2226//
2227//#if MEMDLEAK || defined(__MCRTDBG)
2228//
2229// TYPE* pNewData = nullptr;
2230//
2231// if(::get_task() != nullptr)
2232// {
2233//
2234//#if defined(__MCRTDBG)
2235//
2236// if(::get_task()->m_strFile.has_character())
2237// {
2238//
2239// pNewData = MEMORY::allocate(newAllocationSize, ::get_task()->m_strFile,::get_task()->m_iLine);
2240//
2241// }
2242// else
2243// {
2244//
2245// pNewData = MEMORY::allocate(newAllocationSize, __FILE__, __LINE__);
2246//
2247// }
2248//
2249//#else
2250//
2251// if (::get_task_object_debug().has_character())
2252// {
2253//
2254// pNewData = MEMORY::allocate(newAllocationSize, "thread://" + ::get_task_object_name() + ", " + ::get_task_object_debug() + ", " + string(__FILE__), __LINE__);
2255//
2256// }
2257// else
2258// {
2259//
2260// pNewData = MEMORY::allocate(newAllocationSize, "thread://" + ::get_task_object_name() + ", " + string(__FILE__), __LINE__);
2261//
2262// }
2263//
2264//#endif
2265//
2266// }
2267// else
2268// {
2269//
2270// pNewData = MEMORY::allocate(newAllocationSize, __FILE__, __LINE__);
2271//
2272// }
2273//
2274//#else
2275//
2276// TYPE * pNewData = MEMORY::allocate(newAllocationSize);
2277//
2278//#endif
2279//
2280// // copy ___new data from old
2281// ::safe_memory_copy(pNewData, (size_t)newAllocationSize * sizeof(TYPE), this->m_begin, (size_t) this->size() * sizeof(TYPE));
2282//
2283// // get rid of old stuff (note: no destructors called)
2284// MEMORY::free(this->m_begin);
2285//
2286// this->m_begin = pNewData;
2287//
2288// this->m_end = this->m_begin + countOld;
2289//
2290// }
2291//
2292// m_countAllocation = newAllocationSize;
2293//
2294//}
2295//
2296//
2297//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
2298//::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::_allocate(::collection::count nNewSize, bool bShrink, bool bRaw, const TYPE * ptype)
2299//{
2300//
2301// ASSERT(nNewSize >= 0);
2302//
2303// if(nNewSize < 0)
2304// {
2305//
2306// throw_exception(error_bad_argument);
2307//
2308// }
2309//
2310// ::collection::count countOld = get_count();
2311//
2312// if(nNewSize == countOld)
2313// {
2314//
2315// return countOld;
2316//
2317// }
2318//
2319// if(nNewSize == 0)
2320// {
2321//
2322// if(this->m_begin != nullptr)
2323// {
2324//
2325// TYPED::destruct_count(this->m_begin, this->size());
2326//
2327// if(bShrink)
2328// {
2329//
2330// MEMORY::free(this->m_begin);
2331//
2332// this->m_begin = nullptr;
2333//
2334// m_countAllocation = 0;
2335//
2336// }
2337//
2338// }
2339//
2340// this->m_end = this->m_begin;
2341//
2342// }
2343// else if(this->m_begin == nullptr)
2344// {
2345//
2346// if(nNewSize > UPTR_MAXIMUM / sizeof(TYPE))
2347// {
2348//
2349// throw_exception(error_no_memory);
2350//
2351// }
2352//
2353// auto nAllocSize = maximum(nNewSize, m_countAddUp);
2354//
2355//#if MEMDLEAK || defined(__MCRTDBG)
2356//
2357// if(::get_task() != nullptr)
2358// {
2359//
2360//#if defined(__MCRTDBG)
2361//
2362// if(::get_task()->m_strFile.has_character())
2363// {
2364//
2365// this->m_begin = MEMORY::allocate(nAllocSize, ::get_task()->m_strFile, ::get_task()->m_iLine);
2366//
2367// }
2368// else
2369// {
2370//
2371// this->m_begin = MEMORY::allocate(nAllocSize, __FILE__, __LINE__);
2372//
2373// }
2374//
2375//#else
2376//
2377// if (::get_task_object_debug().has_character())
2378// {
2379//
2380// this->m_begin = MEMORY::allocate(nAllocSize, "thread://" + ::get_task_object_name() + ", " + ::get_task_object_debug() + ", " + string(__FILE__), __LINE__);
2381//
2382// }
2383// else
2384// {
2385//
2386// this->m_begin = MEMORY::allocate(nAllocSize, "thread://" + ::get_task_object_name() + ", " + string(__FILE__), __LINE__);
2387//
2388// }
2389//
2390//#endif
2391//
2392// }
2393// else
2394// {
2395//
2396// this->m_begin = MEMORY::allocate(nAllocSize, __FILE__, __LINE__);
2397//
2398// }
2399//
2400//#else
2401//
2402// this->m_begin = MEMORY::allocate(nAllocSize);
2403//
2404//#endif
2405//
2406// if(!bRaw)
2407// {
2408//
2409// if (::is_null(ptype))
2410// {
2411//
2412// TYPED::construct_count(this->m_begin, nNewSize);
2413//
2414// }
2415// else
2416// {
2417//
2418// TYPED::copy_construct_count(this->m_begin, nNewSize, *ptype);
2419//
2420// }
2421//
2422// }
2423//
2424// this->m_end = this->m_begin + nNewSize;
2425//
2426// m_countAllocation = nAllocSize;
2427//
2428// }
2429// else if(nNewSize <= m_countAllocation)
2430// {
2431//
2432// if (!bRaw)
2433// {
2434//
2435// if (nNewSize > countOld)
2436// {
2437//
2438// if (::is_null(ptype))
2439// {
2440//
2441// TYPED::construct_count(this->m_begin + countOld, nNewSize - countOld);
2442//
2443// }
2444// else
2445// {
2446//
2447// TYPED::copy_construct_count(this->m_begin + countOld, nNewSize - countOld, *ptype);
2448//
2449// }
2450//
2451// }
2452// else if (countOld > nNewSize)
2453// {
2454//
2455// TYPED::destruct_count(this->m_begin + nNewSize, countOld - nNewSize);
2456//
2457// }
2458//
2459// }
2460//
2461// this->m_end = this->m_begin + nNewSize;
2462//
2463// }
2464// else
2465// {
2466//
2467// auto countAddUp = m_countAddUp;
2468//
2469// if(countAddUp <= 0)
2470// {
2471//
2472// countAddUp = this->size();
2473//
2474// constrain(countAddUp, 4, 1024);
2475//
2476// }
2477//
2478// ::collection::count countNewAllocation;
2479//
2480// if(nNewSize < m_countAllocation + countAddUp)
2481// {
2482//
2483// countNewAllocation = m_countAllocation + countAddUp;
2484//
2485// }
2486// else
2487// {
2488//
2489// countNewAllocation = nNewSize;
2490//
2491// }
2492//
2493// if(countNewAllocation > UPTR_MAXIMUM / sizeof(TYPE))
2494// {
2495//
2496// throw_exception(error_no_memory);
2497//
2498// }
2499//
2500//#if MEMDLEAK || defined(__MCRTDBG)
2501//
2502// TYPE* pNewData = nullptr;
2503//
2504// if(::get_task() != nullptr)
2505// {
2506//
2507//#if defined(__MCRTDBG)
2508//
2509// if(::get_task()->m_strFile.has_character())
2510// {
2511//
2512// pNewData = MEMORY::allocate(countNewAllocation, ::get_task()->m_strFile,::get_task()->m_iLine);
2513//
2514// }
2515// else
2516// {
2517//
2518// pNewData = MEMORY::allocate(countNewAllocation, __FILE__, __LINE__);
2519//
2520// }
2521//
2522//#else
2523//
2524// if (::get_task_object_debug().has_character())
2525// {
2526//
2527// pNewData = MEMORY::allocate(countNewAllocation, "thread://" + ::get_task_object_name() + ", " + ::get_task_object_debug() + ", " + string(__FILE__), __LINE__);
2528//
2529// }
2530// else
2531// {
2532//
2533// pNewData = MEMORY::allocate(countNewAllocation, "thread://" + ::get_task_object_name() + ", " + string(__FILE__), __LINE__);
2534//
2535// }
2536//
2537//#endif
2538//
2539// }
2540// else
2541// {
2542//
2543// pNewData = MEMORY::allocate(countNewAllocation, __FILE__, __LINE__);
2544//
2545// }
2546//
2547//
2548//#else
2549//
2550// TYPE * pNewData = MEMORY::allocate(countNewAllocation);
2551//
2552//#endif
2553//
2554// // copy ___new data from old
2555// ::safe_memory_copy(pNewData, (size_t)countNewAllocation * sizeof(TYPE), this->m_begin, (size_t) countOld * sizeof(TYPE));
2556//
2557// if(!bRaw)
2558// {
2559//
2560// // construct remaining elements
2561// ASSERT(nNewSize > countOld);
2562//
2563// if (nNewSize > countOld)
2564// {
2565//
2566// if (::is_null(ptype))
2567// {
2568//
2569// TYPED::construct_count(pNewData + countOld, nNewSize - countOld);
2570//
2571// }
2572// else
2573// {
2574//
2575// TYPED::copy_construct_count(pNewData + countOld, nNewSize - countOld, *ptype);
2576//
2577// }
2578//
2579// }
2580//
2581// }
2582//
2583// // get rid of old stuff (note: no destructors called)
2584// MEMORY::free(this->m_begin);
2585//
2586// this->m_begin = pNewData;
2587//
2588// this->m_end = this->m_begin + nNewSize;
2589//
2590// m_countAllocation = countNewAllocation;
2591//
2592// }
2593//
2594// return countOld;
2595//
2596//}
2597//
2598//
2884//
2885//
2886//
2887//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
2888//void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::on_after_read()
2889//{
2890//
2891//
2892//}
2893//
2894//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
2895//inline void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::set_at_grow(::collection::index nIndex, ARG_TYPE newElement)
2896//{
2897//
2898// ASSERT(nIndex >= 0);
2899//
2900// if (nIndex >= this->size())
2901// {
2902//
2903// this->set_size(nIndex + 1);
2904//
2905// }
2906//
2907// this->m_begin[nIndex] = newElement;
2908//
2909//}
2910//
2911//
2912//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
2913//inline TYPE & base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::element_at_grow(::collection::index nIndex)
2914//{
2915//
2916// ASSERT(nIndex >= 0);
2917//
2918// if (nIndex >= this->size())
2919// {
2920//
2921// this->set_size(nIndex + 1);
2922//
2923// }
2924//
2925// return this->m_begin[nIndex];
2926//
2927//}
2928//
2929//
2930//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
2931//inline void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::set_each(ARG_TYPE element, ::collection::index first, ::collection::count in_count_out_last)
2932//{
2933//
2934// prepare_first_in_count_last_out(first, in_count_out_last);
2935//
2936// for(::collection::index i = first; i <= in_count_out_last; i++)
2937// {
2938//
2939// this->m_begin[i] = element;
2940//
2941// }
2942//
2943//}
2944//
2945//
2946//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
2947//template < typename ITERATOR2 >
2948//inline void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::erase(const ITERATOR2 & begin, const ITERATOR2 & last)
2949//{
2950//
2951// auto start = this->index_of(begin);
2952//
2953// auto end = this->index_of(last);
2954//
2955// if(start < 0 || (end <= start && end >= 0))
2956// {
2957//
2958// return;
2959//
2960// }
2961//
2962// auto count = end > start ? end - start : -1;
2963//
2964// erase_at(start, count);
2965//
2966//}
2967//
2968//
2969//
2970//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
2971//bool base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::prepare_first_last(::collection::index & first, ::collection::index & last) const
2972//{
2973//
2974// if (first < 0)
2975// {
2976//
2977// first += this->get_count();
2978//
2979// }
2980//
2981// if (last < 0)
2982// {
2983//
2984// last += this->get_count();
2985//
2986// }
2987//
2988// return last >= first;
2989//
2990//}
2991//
2992//
2993//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
2994//bool base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::prepare_first_in_count_last_out(::collection::index & first, ::collection::count & in_count_out_last) const
2995//{
2996//
2997// if (first < 0)
2998// {
2999//
3000// first += this->get_count();
3001//
3002// }
3003//
3004// if(first < 0)
3005// {
3006//
3007// first = 0;
3008//
3009// }
3010//
3011// if (in_count_out_last < 0)
3012// {
3013//
3014// in_count_out_last += this->get_count();
3015//
3016// }
3017// else
3018// {
3019//
3020// in_count_out_last = first + in_count_out_last - 1;
3021//
3022// }
3023//
3024// return in_count_out_last >= first;
3025//
3026//}
3027//
3028//
3035//
3036//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3037//inline ::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::get_size() const
3038//{
3039// return (::collection::count) this->size();
3040//}
3041//
3042//
3043//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3044//inline ::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::get_count() const
3045//{
3046// return (::collection::count) this->size();
3047//}
3048//
3049//
3050//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3051//inline ::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::get_length() const
3052//{
3053// return (::collection::count) this->size();
3054//}
3055//
3056//
3057//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3058//inline ::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::get_size_in_bytes() const
3059//{
3060// return (::collection::count)this->size() * sizeof(TYPE);
3061//}
3062//
3063//
3064//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3065//inline ::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::get_byte_count() const
3066//{
3067// return (::collection::count) (this->size() * sizeof(TYPE));
3068//}
3069//
3070//
3077//
3078//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3079//inline ::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::collection::count() const
3080//{
3081// return this->get_count();
3082//}
3083//
3084//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3085//inline ::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::length() const
3086//{
3087// return this->get_length();
3088//}
3089//
3095//
3096//
3102//
3108//
3114//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3115//inline ::collection::index base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::get_lower_bound(::collection::index i) const
3116//{
3117// return i < this->size() ? i : -1;
3118//}
3119//
3120//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3121//inline ::collection::index base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::get_middle_index(::collection::index iIndex) const
3122//{
3123// return this->size() / 2 + iIndex;
3124//}
3125//
3126//
3127//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3128//inline ::collection::index base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::get_upper_bound(::collection::index iIndex) const
3129//{
3130// return this->size() + iIndex;
3131//}
3132//
3133//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3134//inline bool base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::bounds(::collection::index i) const
3135//{
3136// return i >= 0 && i < this->size();
3137//}
3138//
3139//
3140//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3141//inline ::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::erase_all()
3142//{
3143//
3144// return allocate(0, false, false);
3145//
3146//}
3147//
3148//
3149//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3150//inline ::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::set_size(::collection::index nNewSize)
3151//{
3152//
3153// return allocate(nNewSize, false, false);
3154//
3155//}
3156//
3157//
3158//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3159//inline void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::clear()
3160//{
3161//
3162// erase_all();
3163//
3164//}
3165//
3166//
3167//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3168//inline void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::erase_last()
3169//{
3170// ASSERT(this->size() > 0);
3171// erase_at(get_upper_bound());
3172//}
3173//
3174//
3175//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3176//inline void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::zero(::collection::index iStart,::collection::count c)
3177//{
3178// if(c < 0)
3179// {
3180// c = get_size() - iStart;
3181// }
3182// ::zero(&this->m_begin[iStart],c * sizeof(TYPE));
3183//}
3184//
3185//
3186//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3187//inline const TYPE& base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::element_at(::collection::index nIndex) const
3188//{
3189//
3190// ASSERT(nIndex >= 0 && nIndex < this->size());
3191//
3192// return this->m_begin[nIndex];
3193//
3194//}
3195//
3196//
3197//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3198//inline TYPE& base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::element_at(::collection::index nIndex)
3199//{
3200//
3201// ASSERT(nIndex >= 0 && nIndex < this->size());
3202//
3203// return this->m_begin[nIndex];
3204//
3205//}
3206//
3240//
3248//
3249//
3257//
3258//
3259//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3260//inline void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::__swap(::collection::index index1, ::collection::index index2)
3261//{
3262//
3263// ::__swap(this->m_begin[index1], this->m_begin[index2]);
3264//
3265//}
3266//
3267//
3268//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3269//inline void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::__swap(iterator it1, iterator it2)
3270//{
3271//
3272// TYPE t = *it1;
3273//
3274// *it1 = *it2;
3275//
3276// *it2 = t;
3277//
3278//}
3279//
3280//
3281//
3282//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3283//inline void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::__swap(const_iterator it1, const_iterator it2)
3284//{
3285//
3286// auto t = (TYPE) *it1;
3287//
3288// ((TYPE &)*it1) = (const TYPE &) *it2;
3289//
3290// ((TYPE &)*it2) = t;
3291//
3292//}
3293//
3294//
3295//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3296//inline const TYPE& base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::first(::collection::index nIndex) const
3297//{
3298//
3299// return this->element_at(nIndex);
3300//
3301//}
3302//
3303//
3304//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3305//inline TYPE & base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::first(::collection::index nIndex)
3306//{
3307//
3308// return this->element_at(nIndex);
3309//
3310//}
3311//
3312//
3313//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3314//inline const TYPE & base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::last(::collection::index i) const
3315//{
3316//
3317// return element_at(this->get_upper_bound(i));
3318//
3319//}
3320//
3321//
3322//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3323//inline TYPE & base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::last(::collection::index i)
3324//{
3325//
3326// return element_at(this->get_upper_bound(i));
3327//
3328//}
3329//
3330//
3331//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3332//inline const TYPE & base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::middle(::collection::index i) const
3333//{
3334//
3335// return element_at(this->get_middle_index(i));
3336//
3337//}
3338//
3339//
3340//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3341//inline TYPE & base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::middle(::collection::index i)
3342//{
3343//
3344// return element_at(this->get_middle_index(i));
3345//
3346//}
3347//
3348//
3349//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3350//void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::set_all(const TYPE & t)
3351//{
3352//
3353// for (::collection::index i = 0; i < get_count(); i++)
3354// {
3355//
3356// this->m_begin[i] = t;
3357//
3358// }
3359//
3360//}
3361//
3362//
3380//
3381//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3382//inline TYPE base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::pop(::collection::index n)
3383//{
3384//
3385// ::collection::index i = this->get_upper_bound(n);
3386//
3387// TYPE t = element_at(i);
3388//
3389// this->erase_at(i);
3390//
3391// return t;
3392//
3393//}
3394//
3395//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3396//inline TYPE base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::pop_first(::collection::index i)
3397//{
3398//
3399// auto t = ::transfer(this->first(i));
3400//
3401// this->erase_at(i);
3402//
3403// return t;
3404//
3405//}
3406//
3407//
3408//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3409//inline void base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::pop_back(::collection::index n)
3410//{
3411//
3412// erase_at(this->get_upper_bound(n));
3413//
3414//}
3415//
3416//
3417//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3418//inline ::collection::index base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::push(ARG_TYPE newElement)
3419//{
3420//
3421// return index_of(&insert_at(this->size(), newElement));
3422//
3423//}
3424//
3425//
3426//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3427//inline TYPE& base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::add_item(ARG_TYPE newElement)
3428//{
3429//
3430// auto nIndex = this->size();
3431//
3432// this->allocate(nIndex + 1, false, false, newElement);
3433//
3434// return this->element_at(nIndex);
3435//
3436//}
3437//
3438//
3439//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3440//TYPE& base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::add_new()
3441//{
3442//
3443// auto nIndex = this->size();
3444//
3445// this->allocate(nIndex + 1, false, false);
3446//
3447// return this->last();
3448//
3449//}
3450//
3451//
3459//
3460//
3461//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3462//inline TYPE base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::takeAt(::collection::index i)
3463//{
3464//
3465// TYPE t = element_at(i);
3466//
3467// this->erase_at(i);
3468//
3469// return t;
3470//
3471//}
3472//
3473//
3474//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3475//inline TYPE base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::takeFirst(::collection::index i)
3476//{
3477//
3478// TYPE t = element_at(i);
3479//
3480// this->erase_at(i);
3481//
3482// return t;
3483//
3484//}
3485//
3486//
3487//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3488//inline TYPE base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::takeLast(::collection::index n)
3489//{
3490//
3491// ::collection::index i = this->get_upper_bound(n);
3492//
3493// TYPE t = element_at(i);
3494//
3495// this->erase_at(i);
3496//
3497// return t;
3498//
3499//}
3500//
3501//
3502//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3503//base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::base_array_quantum(const TYPE * p, ::collection::count c)
3504//{
3505//
3506// m_countAddUp = 0;
3507// this->m_begin = nullptr;
3508// this->m_end = nullptr;
3509// m_countAllocation = 0;
3510//
3511// set_size(c);
3512//
3513// for (::collection::index i = 0; i < c; i++)
3514// {
3515//
3516// element_at(i) = p[i];
3517//
3518// }
3519//
3520//}
3521//
3522//template < typename TYPE, typename ARG_TYPE, typename TYPED, typename MEMORY, ::enum_type t_etypeContainer >
3523//inline ::collection::count base_array_quantum < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > ::erase(const TYPE * begin, const TYPE * last)
3524//{
3525//
3526// auto iStart = index_of(begin);
3527//
3528// auto iEnd = index_of(last);
3529//
3530// // iEnd exclusive
3531// return erase_at(iStart, iEnd - iStart);
3532//
3533//}
3534//
Definition base_array.h:112
Definition particle.h:95