22
22
#include < cstddef>
23
23
#include < functional>
24
24
25
+ #include " gz/sim/config.hh"
26
+
25
27
namespace gz
26
28
{
27
29
namespace sim
28
30
{
31
+ inline namespace GZ_SIM_VERSION_NAMESPACE {
29
32
// ////////////////////////////////////////////////
30
33
// / This container implements a simple masked vector.
31
34
// / Using a masked vector for systems ensures that
@@ -103,7 +106,7 @@ namespace gz
103
106
private: std::vector<std::size_t > freeSpots;
104
107
105
108
// ////////////////////////////////////////
106
- class iterator {
109
+ class Iterator {
107
110
std::size_t num;
108
111
SystemContainer<T>* parent;
109
112
public:
@@ -112,12 +115,12 @@ namespace gz
112
115
using difference_type = long ;
113
116
using pointer = T*;
114
117
using reference = T&;
115
- explicit iterator (SystemContainer<T>* _parent, std::size_t _num = 0 ) :
118
+ explicit Iterator (SystemContainer<T>* _parent, std::size_t _num = 0 ) :
116
119
num(_num), parent(_parent)
117
120
{
118
121
119
122
}
120
- iterator & operator ++() {
123
+ Iterator & operator ++() {
121
124
auto end = parent->end ();
122
125
// O(n) for now
123
126
do {
@@ -126,36 +129,37 @@ namespace gz
126
129
127
130
return *this ;
128
131
}
129
- bool operator ==(iterator other) const { return num == other.num ; }
130
- bool operator !=(iterator other) const { return !(*this == other); }
132
+ bool operator ==(Iterator other) const { return num == other.num ; }
133
+ bool operator !=(Iterator other) const { return !(*this == other); }
131
134
T& operator *() const {
132
135
return parent->systems [num];
133
136
}
134
137
};
135
138
136
139
// ////////////////////////////////////////
137
- public: iterator begin ()
140
+ public: Iterator begin ()
138
141
{
139
- return iterator (this );
142
+ return Iterator (this );
140
143
}
141
144
142
145
// ////////////////////////////////////////
143
- public: iterator end ()
146
+ public: Iterator end ()
144
147
{
145
148
auto lastIdx = this ->occupied .size ();
146
149
147
150
if (lastIdx == 0 )
148
151
{
149
- return iterator (this );
152
+ return Iterator (this );
150
153
}
151
154
152
155
while (!this ->occupied [lastIdx-1 ] && lastIdx != 0 )
153
156
{
154
157
lastIdx--;
155
158
}
156
- return iterator (this , lastIdx);
159
+ return Iterator (this , lastIdx);
157
160
}
158
161
};
162
+ }
159
163
}
160
164
}
161
165
0 commit comments