- Qt 5.5
- Qt3D Module
- C++ Classes
- const_iterator
- Qt 5.5.1 Reference Documentation

# const_iterator Class

(Qt3D::QCircularBuffer::const_iterator)

The Qt3D::QCircularBuffer::const_iterator class provides an STL-style const iterator for QCircularBuffer. More...

Header: | #include <Qt3D>
qmake: | QT += 3dcore

- List of all members, including inherited members

## Public Types

typedef | iterator_category

## Public Functions

| const_iterator()
| const_iterator(const QCircularBuffer<T> * buff, int idx)
bool | operator!=(const const_iterator & other) const
const T & | operator*() const
const_iterator | operator+(int j) const
const_iterator & | operator++()
const_iterator | operator++(int)
const_iterator & | operator+=(int j)
const_iterator | operator-(int j) const
int | operator-(const_iterator other) const
const_iterator & | operator--()
const_iterator | operator--(int)
const_iterator & | operator-=(int j)
const T * | operator->() const
bool | operator<(const const_iterator & other) const
bool | operator<=(const const_iterator & other) const
bool | operator==(const const_iterator & other) const
bool | operator>(const const_iterator & other) const
bool | operator>=(const const_iterator & other) const
const T & | operator[](int j) const

## Detailed Description

The Qt3D::QCircularBuffer::const_iterator class provides an STL-style const iterator for QCircularBuffer.

QCircularBuffer provides both STL-Style Iterators and Java-Style Iterators.

See also Qt3D::QCircularBuffer::constBegin(), Qt3D::QCircularBuffer::constEnd(), and Qt3D::QCircularBuffer::iterator.

## Member Type Documentation

### typedef const_iterator::iterator_category

A synonym for std::random_access_iterator_tag indicating this iterator is a random access iterator.

## Member Function Documentation

### const_iterator::const_iterator()

Constructs an uninitialized const iterator.

Functions like operator*() and operator++() should not be called on an uninitialized iterator. Use operator=() to assign a value to it before using it.

See also Qt3D::QCircularBuffer::begin() and Qt3D::QCircularBuffer::end().

### const_iterator::const_iterator(const QCircularBuffer<T> * buff, int idx)

### bool const_iterator::operator!=(const const_iterator & other) const

Returns true if other points to a different item than this iterator; otherwise returns false.

See also operator==().

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

Returns a const reference to the current item.

See also operator->().

### const_iterator const_iterator::operator+(int j) const

Returns an iterator to the item at j positions forward from this iterator. (If j is negative, the iterator goes backward.)

See also operator-() and operator+=().

### const_iterator & const_iterator::operator++()

The prefix ++ operator (`++it`) advances the iterator to the next item in the circular buffer and returns an iterator to the new current item.

Calling this function on Qt3D::QCircularBuffer::constEnd() leads to undefined results.

See also operator--().

### const_iterator const_iterator::operator++(int)

This is an overloaded function.

The postfix ++ operator (`it++`) advances the iterator to the next item in the circular buffer and returns an iterator to the previously current item.

### const_iterator & const_iterator::operator+=(int j)

Advances the iterator by j items. (If j is negative, the iterator goes backward.)

See also operator-=() and operator+().

### const_iterator const_iterator::operator-(int j) const

Returns an iterator to the item at j positions backward from this iterator. (If j is negative, the iterator goes forward.)

See also operator+() and operator-=().

### int const_iterator::operator-(const_iterator other) const

Returns the number of items between the item pointed to by other and the item pointed to by this iterator.

### const_iterator & const_iterator::operator--()

The prefix -- operator (`--it`) makes the preceding item the current and returns an iterator to the new current item.

Calling this function on Qt3D::QCircularBuffer::constBegin() leads to undefined results.

See also operator++().

### const_iterator const_iterator::operator--(int)

This is an overloaded function.

The postfix -- operator (`it--`) makes the preceding item the current and returns an iterator to the previously current item.

### const_iterator & const_iterator::operator-=(int j)

Makes the iterator go back by j items. (If j is negative, the iterator goes forward.)

See also operator+=() and operator-().

### const T * const_iterator::operator->() const

Returns a pointer to the current item.

See also operator*().

### bool const_iterator::operator<(const const_iterator & other) const

Returns true if the item pointed to by this iterator occurs before the item pointed to by the other iterator.

### bool const_iterator::operator<=(const const_iterator & other) const

Returns true if the item pointed to by this iterator occurs before, or at the same position as the item pointed to by the other iterator.

### bool const_iterator::operator==(const const_iterator & other) const

Returns true if other points to the same item as this iterator; otherwise returns false.

See also operator!=().

### bool const_iterator::operator>(const const_iterator & other) const

Returns true if the item pointed to by this iterator occurs after the item pointed to by the other iterator.

### bool const_iterator::operator>=(const const_iterator & other) const

Returns true if the item pointed to by this iterator occurs after, or at the same position as the item pointed to by the other iterator.

### const T & const_iterator::operator[](int j) const

Returns a const reference to the item at position *this + j.

This function is provided to make QCircularBuffer iterators behave like C++ pointers.

See also operator+().