acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
pointer_array_process.h
1// Enhanced on 2025-04-23 20:49 by camilo <3ThomasBorregaardSørensen!!, Mummi!! and bilbo!!
2#pragma once
3
4
5#include "acme/prototype/collection/pointer_container.h"
6
7
8template < typename POINTER_ARRAY_PROCESS, typename TYPE >
9class pointer_array_process : public POINTER_ARRAY_PROCESS
10{
11public:
12
13 using POINTER_ARRAY_PROCESS_BASE_TYPE = typename POINTER_ARRAY_PROCESS::BASE_TYPE;
14
15 //using POINTER_ARRAY_PROCESS::POINTER_ARRAY_PROCESS;
16 using BASE_ARRAY = POINTER_ARRAY_PROCESS;
17
18 //using ref_iterator = typename POINTER_ARRAY_PROCESS::ref_iterator;
19 //using const_ref_iterator = typename POINTER_ARRAY_PROCESS::const_ref_iterator;
20
21
22 using BASE_ARRAY::BASE_ARRAY;
23 using BASE_ARRAY::operator =;
24
25
26 // pointer_array_process() { }
27 pointer_array_process(const pointer_array_process & array) : BASE_ARRAY(array) { }
28 // pointer_array_process(pointer_array_process && array) noexcept : BASE_ARRAY(::transfer(array)) { }
29
30 //inline auto ptra(::collection::index iStart = 0, ::collection::index iEnd = -1) { return ARRAY_BASE::values(iStart, iEnd); }
31
32 //inline auto ptra(::collection::index iStart = 0, ::collection::index iEnd = -1) const { return ARRAY_BASE::values(iStart, iEnd); }
33
34 //inline auto values(::collection::index iStart = 0, ::collection::index iEnd = -1) { return ref_iterator(iStart, iEnd, this); }
35
36 //inline auto values(::collection::index iStart = 0, ::collection::index iEnd = -1) const { return const_ref_iterator(iStart, iEnd, this); }
37
38 //inline auto begin() { return ref_iterator(0, m_nSize, this); }
39
40 //inline auto end() { return ref_iterator(m_nSize, m_nSize, this); }
41
42 //inline auto begin() const { return const_ref_iterator(0, m_nSize, this); }
43
44 //inline auto end() const { return const_ref_iterator(m_nSize, m_nSize, this); }
45
46 //ref_iterator ref_it(::collection::index iStart) { return ref_iterator(iStart, this); }
47 //ref_iterator ref_it(::collection::index iStart, ::collection::count cCount) { return ref_iterator(iStart + (cCount < 0 ? this->get_count() + cCount + 1 : cCount), this); }
48
49 //ref_iterator_range refa(::collection::index iStart = 0, ::collection::count cCount = -1) { return ref_iterator(ref_it(iStart), ref_it(iStart, cCount)); }
50
51 template < typename REF >
52 inline bool contains_ref(const REF & ref)
53 {
54
55 for (auto & p : *this)
56 {
57
58 if (*p == ref)
59 {
60
61 return true;
62
63 }
64
65 }
66
67 return false;
68
69 }
70
71
72 POINTER_ARRAY_PROCESS_BASE_TYPE pop()
73 {
74
75 if (this->is_empty())
76 {
77
78 return nullptr;
79
80 }
81
82 return POINTER_ARRAY_PROCESS::pop();
83
84 }
85
86 TYPE& first_ref(::collection::index n = 0) const
87 {
88
89 return *this->first(n);
90
91 }
92
93
94 TYPE& first_ref(::collection::index n = 0)
95 {
96
97 return *this->first(n);
98
99 }
100
101
102
103 TYPE& last_ref(::collection::index n = -1) const
104 {
105
106 return *this->last(n);
107
108 }
109
110
111 TYPE& last_ref(::collection::index n = -1)
112 {
113
114 return *this->last(n);
115
116 }
117
118
119 //pointer_array_process & operator=(const pointer_array_process & ptra) { POINTER_ARRAY_PROCESS::operator=(ptra); return *this; }
120 //pointer_array_process & operator=(pointer_array_process && ptra) { POINTER_ARRAY_PROCESS::operator=(::transfer(ptra)); return *this; }
121
122
123};
124
125
126
127
128
129
Definition cfref.h:37