7 * Iterator for vectors containing pointers to Type.
8 * Attention: Dereferenced iterator returns copy of the Type
9 * (not pointer to Type)!
10 * For usage it should be enough to public inherit from this class and
11 * declare some friend methods (functions).
18 * iterator begin() const;
19 * iterator end() const;
21 * class iterator : public VectorPointerIterator<QString>{
23 * friend iterator Cl::begin() const;
24 * friend iterator Cl::end() const;
30 class VectorPointerIterator
{
32 typedef typename
std::vector
<Type
*>::const_iterator iterator_t
;
36 VectorPointerIterator(){}
37 VectorPointerIterator(const VectorPointerIterator
&iter
) : it(iter
.it
){}
38 virtual VectorPointerIterator
39 &operator=(const VectorPointerIterator
& iter
)
40 { it
= iter
.it
; return *this; }
42 operator==(const VectorPointerIterator
& iter
){ return it
== iter
.it
; }
44 operator!=(const VectorPointerIterator
& iter
){ return it
!= iter
.it
; }
45 virtual VectorPointerIterator
&operator++(){ it
++; return *this; }
46 virtual VectorPointerIterator
&operator++(int){ it
++; return *this; }
47 virtual VectorPointerIterator
&operator--(){ it
--; return *this; }
48 virtual VectorPointerIterator
&operator--(int){ it
--; return *this; }
49 virtual Type
operator*() const{ return **it
; }