From 366a8063730aa7ae696bcb9cf56eafd13d43dfc0 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sun, 8 Feb 2009 00:44:10 +0000 Subject: 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. --- src/array.h | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/array.h') 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 return *this; } - bool operator==( const iterator &oth ) + bool operator==( const iterator &oth ) const { return iPos == oth.iPos; } - bool operator!=( const iterator &oth ) + bool operator!=( const iterator &oth ) const { return iPos != oth.iPos; } @@ -244,6 +244,16 @@ namespace Bu "Cannot dereference finished iterator."); return src[iPos]; } + + operator bool() const + { + return iPos < 0; + } + + bool isValid() const + { + return iPos < 0; + } } iterator; typedef struct const_iterator @@ -302,12 +312,12 @@ namespace Bu return *this; } - bool operator==( const const_iterator &oth ) + bool operator==( const const_iterator &oth ) const { return iPos == oth.iPos; } - bool operator!=( const const_iterator &oth ) + bool operator!=( const const_iterator &oth ) const { return iPos != oth.iPos; } @@ -327,6 +337,16 @@ namespace Bu "Cannot dereference finished iterator."); return src[iPos]; } + + operator bool() const + { + return iPos < 0; + } + + bool isValid() const + { + return iPos < 0; + } } const_iterator; iterator begin() -- cgit v1.2.3