--- parser3/src/include/pa_array.h 2003/03/26 07:45:22 1.57.2.27.2.6 +++ parser3/src/include/pa_array.h 2003/03/27 10:53:01 1.57.2.27.2.9 @@ -8,7 +8,7 @@ #ifndef PA_ARRAY_H #define PA_ARRAY_H -static const char* IDENT_ARRAY_H="$Date: 2003/03/26 07:45:22 $"; +static const char* IDENT_ARRAY_H="$Date: 2003/03/27 10:53:01 $"; // includes @@ -30,10 +30,10 @@ protected: T *felements; // allocated size - int fallocated; + size_t fallocated; // array size - int fused; + size_t fused; public: typedef T element_type; @@ -46,7 +46,7 @@ public: } /// how many items are in Array - int count() const { return fused; } + size_t count() const { return fused; } /// append to array Array& operator += (T src) { if(is_full()) @@ -88,29 +88,42 @@ public: return *this; } - /// get index-element - T& get(int index) const { - if(!(index>=0 && index=0 && index=0 && index a; - Array_iterator i(a); - while(i.has_next()) { + for(Array_iterator i(a); i.has_next(); ) { T& element=i.next(); ... } @@ -179,22 +191,21 @@ public: } /// quickly extracts next Array element - const T& next() { + const T next() { return *(fcurrent++); } }; - +/* /** Nonconst array iterator, usage: @code // Array a; - Array_iterator i(a); - while(i.has_next()) { + for(Array_iterator i(a); i.has_next(); ) { T& element=i.next(); ... } @endcode -*/ +* / template class Array_modifing_iterator { Array& farray; @@ -219,5 +230,5 @@ public: } }; - +*/ #endif