diff options
Diffstat (limited to 'src/array.h')
-rw-r--r-- | src/array.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/array.h b/src/array.h index 0fb0df3..e717fd5 100644 --- a/src/array.h +++ b/src/array.h | |||
@@ -219,12 +219,12 @@ namespace Bu | |||
219 | return *this; | 219 | return *this; |
220 | } | 220 | } |
221 | 221 | ||
222 | bool operator==( const iterator &oth ) | 222 | bool operator==( const iterator &oth ) const |
223 | { | 223 | { |
224 | return iPos == oth.iPos; | 224 | return iPos == oth.iPos; |
225 | } | 225 | } |
226 | 226 | ||
227 | bool operator!=( const iterator &oth ) | 227 | bool operator!=( const iterator &oth ) const |
228 | { | 228 | { |
229 | return iPos != oth.iPos; | 229 | return iPos != oth.iPos; |
230 | } | 230 | } |
@@ -244,6 +244,16 @@ namespace Bu | |||
244 | "Cannot dereference finished iterator."); | 244 | "Cannot dereference finished iterator."); |
245 | return src[iPos]; | 245 | return src[iPos]; |
246 | } | 246 | } |
247 | |||
248 | operator bool() const | ||
249 | { | ||
250 | return iPos < 0; | ||
251 | } | ||
252 | |||
253 | bool isValid() const | ||
254 | { | ||
255 | return iPos < 0; | ||
256 | } | ||
247 | } iterator; | 257 | } iterator; |
248 | 258 | ||
249 | typedef struct const_iterator | 259 | typedef struct const_iterator |
@@ -302,12 +312,12 @@ namespace Bu | |||
302 | return *this; | 312 | return *this; |
303 | } | 313 | } |
304 | 314 | ||
305 | bool operator==( const const_iterator &oth ) | 315 | bool operator==( const const_iterator &oth ) const |
306 | { | 316 | { |
307 | return iPos == oth.iPos; | 317 | return iPos == oth.iPos; |
308 | } | 318 | } |
309 | 319 | ||
310 | bool operator!=( const const_iterator &oth ) | 320 | bool operator!=( const const_iterator &oth ) const |
311 | { | 321 | { |
312 | return iPos != oth.iPos; | 322 | return iPos != oth.iPos; |
313 | } | 323 | } |
@@ -327,6 +337,16 @@ namespace Bu | |||
327 | "Cannot dereference finished iterator."); | 337 | "Cannot dereference finished iterator."); |
328 | return src[iPos]; | 338 | return src[iPos]; |
329 | } | 339 | } |
340 | |||
341 | operator bool() const | ||
342 | { | ||
343 | return iPos < 0; | ||
344 | } | ||
345 | |||
346 | bool isValid() const | ||
347 | { | ||
348 | return iPos < 0; | ||
349 | } | ||
330 | } const_iterator; | 350 | } const_iterator; |
331 | 351 | ||
332 | iterator begin() | 352 | iterator begin() |