QMapConstIterator Class

Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QMapConstIterator Class Reference

The QMapConstIterator class provides an iterator for QMap. More...

`#include <qmap.h>`

List of all member functions.

## Public Members

- typedef std::bidirectional_iterator_tag iterator_category
- typedef T value_type
- typedef const T * pointer
- typedef const T & reference
- QMapConstIterator ()
- QMapConstIterator ( QMapNode<K, T> * p )
- QMapConstIterator ( const QMapConstIterator<K, T> & it )
- QMapConstIterator ( const QMapIterator<K, T> & it )
- bool operator== ( const QMapConstIterator<K, T> & it ) const
- bool operator!= ( const QMapConstIterator<K, T> & it ) const
- const T & operator* () const
- const K & key () const
- const T & data () const
- QMapConstIterator<K, T> & operator++ ()
- QMapConstIterator<K, T> operator++ ( int )
- QMapConstIterator<K, T> & operator-- ()
- QMapConstIterator<K, T> operator-- ( int )

## Detailed Description

The QMapConstIterator class provides an iterator for QMap.

In contrast to QMapIterator, this class is used to iterate over a const map. It does not allow you to modify the values of the map because this would break the const semantics.

For more information on QMap iterators, see QMapIterator and the QMap example.

See also QMap, QMapIterator, Qt Template Library Classes, and Non-GUI Classes.

## Member Type Documentation

### QMapConstIterator::iterator_category

The type of iterator category, `std::bidirectional_iterator_tag`.

### QMapConstIterator::pointer

Const pointer to value_type.

### QMapConstIterator::reference

Const reference to value_type.

### QMapConstIterator::value_type

The type of const value.

## Member Function Documentation

### QMapConstIterator::QMapConstIterator ()

Constructs an uninitialized iterator.

### QMapConstIterator::QMapConstIterator ( QMapNode<K, T> * p )

Constructs an iterator starting at node p.

### QMapConstIterator::QMapConstIterator ( const QMapConstIterator<K, T> & it )

Constructs a copy of the iterator, it.

### QMapConstIterator::QMapConstIterator ( const QMapIterator<K, T> & it )

Constructs a copy of the iterator, it.

### const T & QMapConstIterator::data () const

Returns a const reference to the current item's data.

### const K & QMapConstIterator::key () const

Returns a const reference to the current item's key.

### bool QMapConstIterator::operator!= ( const QMapConstIterator<K, T> & it ) const

Compares the iterator to the it iterator and returns FALSE if they point to the same item; otherwise returns TRUE.

### const T & QMapConstIterator::operator* () const

Dereference operator. Returns a const reference to the current item's data. The same as data().

### QMapConstIterator<K, T> & QMapConstIterator::operator++ ()

Prefix ++ makes the succeeding item current and returns an iterator pointing to the new current item. The iterator cannot check whether it reached the end of the map. Incrementing the iterator returned by end() causes undefined results.

### QMapConstIterator<K, T> QMapConstIterator::operator++ ( int )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Postfix ++ makes the succeeding item current and returns an iterator pointing to the new current item. The iterator cannot check whether it reached the end of the map. Incrementing the iterator returned by end() causes undefined results.

### QMapConstIterator<K, T> & QMapConstIterator::operator-- ()

Prefix -- makes the previous item current and returns an iterator pointing to the new current item. The iterator cannot check whether it reached the beginning of the map. Decrementing the iterator returned by begin() causes undefined results.

### QMapConstIterator<K, T> QMapConstIterator::operator-- ( int )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Postfix -- makes the previous item current and returns an iterator pointing to the new current item. The iterator cannot check whether it reached the beginning of the map. Decrementing the iterator returned by begin() causes undefined results.

### bool QMapConstIterator::operator== ( const QMapConstIterator<K, T> & it ) const

Compares the iterator to the it iterator and returns TRUE if they point to the same item; otherwise returns FALSE.

This file is part of the Qt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.