4 * Iterator functions for aXXX classes.
8 * Copyright (C) 2008 Adam Kropelin
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General
12 * Public License as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
28 template <class I
, class T
>
33 const_iterator(const const_iterator
&rhs
) : _iter(rhs
._iter
) {}
34 const_iterator(const I
&rhs
) : _iter(rhs
) {}
36 const_iterator
&operator++() { ++_iter
; return *this; }
37 const_iterator
operator++(int) { const_iterator
tmp(_iter
); ++_iter
; return tmp
; }
38 const_iterator
&operator--() { --_iter
; return *this; }
39 const_iterator
operator--(int) { const_iterator
tmp(_iter
); --_iter
; return tmp
; }
41 const T
& operator*() const { return *_iter
; }
43 bool operator==(const const_iterator
&rhs
) const { return _iter
== rhs
._iter
; }
44 bool operator!=(const const_iterator
&rhs
) const { return !(*this == rhs
); }
45 bool operator==(const I
&rhs
) const { return _iter
== rhs
; }
46 bool operator!=(const I
&rhs
) const { return !(*this == rhs
); }
48 const_iterator
&operator=(const const_iterator
&rhs
)
49 { if (&rhs
!= this) _iter
= rhs
._iter
; return *this; }
50 const_iterator
&operator=(const I
&rhs
)
51 { if (&rhs
!= &_iter
) _iter
= rhs
; return *this; }