aboutsummaryrefslogtreecommitdiff
path: root/src/array.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-02-08 00:44:10 +0000
committerMike Buland <eichlan@xagasoft.com>2009-02-08 00:44:10 +0000
commit366a8063730aa7ae696bcb9cf56eafd13d43dfc0 (patch)
tree42e3597edfde0c183506ad0d452f045cb7726137 /src/array.h
parent4f59dec6bad120b72f1bc075715d79bfbe881f7e (diff)
downloadlibbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.tar.gz
libbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.tar.bz2
libbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.tar.xz
libbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.zip
So many updates. I recommend using the new FString iterators instead of direct
indexing. It is now many times faster, and requires less overhead. Also, more stuff iterator related in every class. More on that later.
Diffstat (limited to 'src/array.h')
-rw-r--r--src/array.h28
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()