![]() |
ATLAS Offline Software
|
Iterator class for Array<N>.
More...
#include <Array.h>
Classes | |
| class | pointer |
Proxy to return from operator>. More... | |
Public Types | |
| using | iterator_category = std::random_access_iterator_tag |
| using | value_type = const Array<N-1> |
| using | difference_type = std::ptrdiff_t |
| using | reference = value_type& |
Public Member Functions | |
| ArrayIterator () | |
| Default constructor. | |
| ArrayIterator (const Arrayrep *rep, unsigned int offs) | |
Constructor from Arrayrep and offset. | |
| bool | operator== (const ArrayIterator &other) const |
| Equality comparison. | |
| bool | operator!= (const ArrayIterator &other) const |
| Inequality comparison. | |
| bool | operator< (const ArrayIterator &other) const |
| Less-than comparison. | |
| bool | operator> (const ArrayIterator &other) const |
| Greater-than comparison. | |
| bool | operator<= (const ArrayIterator &other) const |
| Less-than-or-equal comparison. | |
| bool | operator>= (const ArrayIterator &other) const |
| Greater-than-or-equal comparison. | |
| value_type | operator* () const |
| Dereference the iterator. | |
| pointer | operator-> () const |
| Dereference the iterator. | |
| ArrayIterator< N > & | operator++ () |
| Advance the iterator. | |
| ArrayIterator< N > | operator++ (int) |
| Advance the iterator. | |
| ArrayIterator< N > & | operator-- () |
| Back up the iterator. | |
| ArrayIterator< N > | operator-- (int) |
| Back up the iterator. | |
| value_type | operator[] (difference_type n) const |
| Array indexing relative to the iterator. | |
| ArrayIterator< N > & | operator+= (difference_type n) |
| Advance the iterator. | |
| ArrayIterator< N > | operator+ (difference_type n) const |
| Return a new iterator pointing n steps ahead. | |
| ArrayIterator< N > & | operator-= (difference_type n) |
| Back up the iterator. | |
| ArrayIterator< N > | operator- (difference_type n) const |
| Return a new iterator pointing n steps behind. | |
| difference_type | operator- (const ArrayIterator &other) const |
| Return the difference between two iterators. | |
Private Attributes | |
| const Arrayrep * | m_rep |
| The underlying array representation. | |
| unsigned int | m_offs |
| Offset into the representation's data array of the first element referred to by this iterator. | |
This serves as an iterator class for Array<N>, where N >= 2. It gives a Array<N-1> as value_type. Only const access is supported.
This class is almost, but not quite, a random access iterator. operator* and operator[] returns a value_type instead of a reference. And operator-> returns a proxy. (The issues here are similar to those encountered with std::vector<bool>.) But it should mostly work as you expect.
Definition at line 391 of file Control/CxxUtils/CxxUtils/Array.h.
| using CxxUtils::ArrayIterator< N >::difference_type = std::ptrdiff_t |
Definition at line 396 of file Control/CxxUtils/CxxUtils/Array.h.
| using CxxUtils::ArrayIterator< N >::iterator_category = std::random_access_iterator_tag |
Definition at line 394 of file Control/CxxUtils/CxxUtils/Array.h.
| using CxxUtils::ArrayIterator< N >::reference = value_type& |
Definition at line 397 of file Control/CxxUtils/CxxUtils/Array.h.
| using CxxUtils::ArrayIterator< N >::value_type = const Array<N-1> |
Definition at line 395 of file Control/CxxUtils/CxxUtils/Array.h.
| CxxUtils::ArrayIterator< N >::ArrayIterator | ( | ) |
Default constructor.
Makes an invalid iterator.
| CxxUtils::ArrayIterator< N >::ArrayIterator | ( | const Arrayrep * | rep, |
| unsigned int | offs ) |
Constructor from Arrayrep and offset.
| rep | The underlying array representation. |
| offs | The offset in the representation of the first element referenced by this iterator. |
| bool CxxUtils::ArrayIterator< N >::operator!= | ( | const ArrayIterator< N > & | other | ) | const |
Inequality comparison.
| other | The other object with which to compare. |
| value_type CxxUtils::ArrayIterator< N >::operator* | ( | ) | const |
Dereference the iterator.
value_type, not a reference. (Thus, this class does not quite conform to the iterator requirements.) | ArrayIterator< N > CxxUtils::ArrayIterator< N >::operator+ | ( | difference_type | n | ) | const |
Return a new iterator pointing n steps ahead.
| n | Number of steps by which to advance. |
| ArrayIterator< N > & CxxUtils::ArrayIterator< N >::operator++ | ( | ) |
Advance the iterator.
| ArrayIterator< N > CxxUtils::ArrayIterator< N >::operator++ | ( | int | ) |
Advance the iterator.
| ArrayIterator< N > & CxxUtils::ArrayIterator< N >::operator+= | ( | difference_type | n | ) |
Advance the iterator.
| n | Number of steps by which to advance the iterator. |
| difference_type CxxUtils::ArrayIterator< N >::operator- | ( | const ArrayIterator< N > & | other | ) | const |
Return the difference between two iterators.
| other | The other iterator for the comparison. |
| ArrayIterator< N > CxxUtils::ArrayIterator< N >::operator- | ( | difference_type | n | ) | const |
Return a new iterator pointing n steps behind.
| n | Number of steps by which to back up. |
| ArrayIterator< N > & CxxUtils::ArrayIterator< N >::operator-- | ( | ) |
Back up the iterator.
| ArrayIterator< N > CxxUtils::ArrayIterator< N >::operator-- | ( | int | ) |
Back up the iterator.
| ArrayIterator< N > & CxxUtils::ArrayIterator< N >::operator-= | ( | difference_type | n | ) |
Back up the iterator.
| n | Number of steps by which to advance the iterator. |
| pointer CxxUtils::ArrayIterator< N >::operator-> | ( | ) | const |
Dereference the iterator.
This method will return a proxy for the array, which you can then dereference. Note that if you get a C++ pointer from this, then it will be valid only until the proxy object gets destroyed.
| bool CxxUtils::ArrayIterator< N >::operator< | ( | const ArrayIterator< N > & | other | ) | const |
Less-than comparison.
| other | The other object with which to compare. |
| bool CxxUtils::ArrayIterator< N >::operator<= | ( | const ArrayIterator< N > & | other | ) | const |
Less-than-or-equal comparison.
| other | The other object with which to compare. |
| bool CxxUtils::ArrayIterator< N >::operator== | ( | const ArrayIterator< N > & | other | ) | const |
Equality comparison.
| other | The other object with which to compare. |
| bool CxxUtils::ArrayIterator< N >::operator> | ( | const ArrayIterator< N > & | other | ) | const |
Greater-than comparison.
| other | The other object with which to compare. |
| bool CxxUtils::ArrayIterator< N >::operator>= | ( | const ArrayIterator< N > & | other | ) | const |
Greater-than-or-equal comparison.
| other | The other object with which to compare. |
| value_type CxxUtils::ArrayIterator< N >::operator[] | ( | difference_type | n | ) | const |
Array indexing relative to the iterator.
| n | The array index. |
value_type, not a reference. (Thus, this class does not quite conform to the iterator requirements.)
|
private |
Offset into the representation's data array of the first element referred to by this iterator.
Definition at line 630 of file Control/CxxUtils/CxxUtils/Array.h.
|
private |
The underlying array representation.
Definition at line 626 of file Control/CxxUtils/CxxUtils/Array.h.