|
|
| version 1.63, 2003/11/25 12:58:53 | version 1.68, 2006/04/09 13:38:47 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: Array & Array_iterator classes decls. | Parser: Array & Array_iterator classes decls. |
| Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| Line 89 public: | Line 89 public: |
| /// append to array | /// append to array |
| Array& operator += (T src) { | Array& operator += (T src) { |
| if(is_full()) | if(is_full()) |
| expand(2); | expand(+2); |
| felements[fused++]=src; | felements[fused++]=src; |
| Line 165 public: | Line 165 public: |
| } | } |
| /// iterate over all elements | /// iterate over all elements |
| template<typename I> void for_each(bool (*callback)(T, I), I info) const { | |
| T *last=felements+fused; | |
| for(T *current=felements; current<last; current++) | |
| if(callback(*current, info)) | |
| return; | |
| } | |
| /// iterate over all elements | |
| template<typename I> void for_each_ref(void (*callback)(T&, I), I info) { | template<typename I> void for_each_ref(void (*callback)(T&, I), I info) { |
| T *last=felements+fused; | T *last=felements+fused; |
| for(T *current=felements; current<last; current++) | for(T *current=felements; current<last; current++) |
| Line 228 public: | Line 236 public: |
| } | } |
| /// quickly extracts next Array element | /// quickly extracts next Array element |
| const T next() { | T next() { |
| return *(fcurrent++); | return *(fcurrent++); |
| } | } |