const_iterator Class

class QJsonArray::const_iterator

QJsonArray::const_iterator 클래스는 QJsonArray 에 대한 STL 스타일 const 이터레이터를 제공합니다. 더 보기...

이 클래스는 매우 유사합니다.

이 클래스는 QJsonArray::iterator매우 유사합니다.

공용 형

공용 함수

const_iterator()
const_iterator(const QJsonArray::iterator &other)
const QJsonValueConstRef operator*() const
QJsonArray::const_iterator operator+(qsizetype j) const
QJsonArray::const_iterator &operator++()
QJsonArray::const_iterator operator++(int)
QJsonArray::const_iterator &operator+=(qsizetype j)
qsizetype operator-(QJsonArray::const_iterator other) const
QJsonArray::const_iterator operator-(qsizetype j) const
QJsonArray::const_iterator &operator--()
QJsonArray::const_iterator operator--(int)
QJsonArray::const_iterator &operator-=(qsizetype j)
const QJsonValueConstRef *operator->() const
QJsonValueConstRef operator[](qsizetype j) const
bool operator!=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator<(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator<=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator==(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator>(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator>=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

상세 설명

QJsonArray::const_iterator 를 사용하면 QJsonArray 를 반복할 수 있습니다. QJsonArray 을 반복하면서 수정하려면 QJsonArray::iterator 을 대신 사용합니다. 이터레이터를 통해 QJsonArray 을 변경해야 하는 경우가 아니라면 일반적으로 생성자가 아닌 QJsonArray 에도 QJsonArray::const_iterator 을 사용하는 것이 좋습니다. Const 이터레이터는 약간 더 빠르며 코드 가독성이 향상됩니다.

기본 QJsonArray::const_iterator 생성자는 초기화되지 않은 이터레이터를 생성합니다. QJsonArray::constBegin (), QJsonArray::constEnd() 또는 QJsonArray::insert()와 같은 QJsonArray 함수를 사용하여 초기화해야 반복을 시작할 수 있습니다.

대부분의 QJsonArray 함수는 이터레이터가 아닌 정수 인덱스를 받습니다. 따라서 이터레이터는 QJsonArray 와 관련하여 거의 유용하지 않습니다. STL 스타일 이터레이터가 적합한 곳은 generic algorithms 에 대한 인수로 사용하는 경우입니다.

동일한 배열에 여러 개의 이터레이터를 사용할 수 있습니다. 하지만 QJsonArray 에서 컨스트가 아닌 함수를 호출하면 기존의 모든 이터레이터가 정의되지 않은 상태로 렌더링된다는 점에 유의하세요.

QJsonArray::iterator도 참조하세요 .

멤버 타입 문서

const_iterator::iterator_category

이 이터레이터가 랜덤 액세스 이터레이터임을 나타내는 std::random_access_iterator_tag의 동의어입니다.

멤버 함수 문서

const_iterator::const_iterator()

초기화되지 않은 이터레이터를 생성합니다.

연산자*() 및 연산자++() 같은 함수는 초기화되지 않은 이터레이터에서 호출해서는 안 됩니다. 사용하기 전에 operator=()를 사용하여 값을 할당하세요.

QJsonArray::constBegin() 및 QJsonArray::constEnd()도 참조하세요 .

const_iterator::const_iterator(const QJsonArray::iterator &other)

other 의 복사본을 생성합니다.

const QJsonValueConstRef const_iterator::operator*() const

현재 항목을 반환합니다.

QJsonArray::const_iterator const_iterator::operator+(qsizetype j) const

이 이터레이터에서 앞으로 j 위치에 있는 항목에 대한 이터레이터를 반환합니다. j 이 음수이면 이터레이터는 뒤로 이동합니다.

operator-() 및 operator+=()도 참조하세요 .

QJsonArray::const_iterator &const_iterator::operator++()

접두사 ++ 연산자 ++it 는 배열의 다음 항목으로 반복자를 전진시키고 새로운 현재 항목으로 반복자를 반환합니다.

QJsonArray::end()에서 이 함수를 호출하면 정의되지 않은 결과가 나타납니다.

operator--()도 참조하세요 .

QJsonArray::const_iterator const_iterator::operator++(int)

이 함수는 오버로드된 함수입니다.

후위 ++ 연산자 it++ 는 배열의 다음 항목으로 반복자를 전진시키고 이전 현재 항목으로 반복자를 반환합니다.

QJsonArray::const_iterator &const_iterator::operator+=(qsizetype j)

반복기를 j 항목만큼 전진시킵니다. j 이 음수이면 반복기는 뒤로 이동합니다.

operator-=() 및 operator+()도 참조하세요 .

qsizetype const_iterator::operator-(QJsonArray::const_iterator other) const

other 에서 가리키는 항목과 이 이터레이터가 가리키는 항목 사이의 항목 수를 반환합니다.

QJsonArray::const_iterator const_iterator::operator-(qsizetype j) const

이 이터레이터에서 뒤로 j 위치에 있는 항목에 이터레이터를 반환합니다. j 이 음수이면 이터레이터는 앞으로 이동합니다.

operator+() 및 operator-=()도 참조하세요 .

QJsonArray::const_iterator &const_iterator::operator--()

접두사 -- 연산자 --it 는 앞의 항목을 현재 항목으로 만들고 새 현재 항목에 반복자를 반환합니다.

QJsonArray::begin()에서 이 함수를 호출하면 정의되지 않은 결과가 나타납니다.

operator++()도 참조하세요 .

QJsonArray::const_iterator const_iterator::operator--(int)

이 함수는 오버로드된 함수입니다.

후위 -- 연산자 it-- 는 이전 항목을 현재 항목으로 만들고 이전 항목에 대한 반복자를 반환합니다.

QJsonArray::const_iterator &const_iterator::operator-=(qsizetype j)

반복기를 j 항목만큼 뒤로 이동합니다. j 이 음수이면 반복기는 앞으로 이동합니다.

operator+=() 및 operator-()도 참조하세요 .

const QJsonValueConstRef *const_iterator::operator->() const

현재 항목에 대한 포인터를 반환합니다.

QJsonValueConstRef const_iterator::operator[](qsizetype j) const

이 이터레이터가 가리키는 항목( *this + j 위치에 있는 항목)에서 오프셋 j 에 있는 항목을 반환합니다.

이 함수는 QJsonArray 이터레이터가 C++ 포인터처럼 동작하도록 하기 위해 제공됩니다.

operator+()도 참조하세요 .

관련 비회원

[noexcept] bool operator!=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhsrhs 이터레이터와 다른 항목을 가리키면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

operator==()도 참조하세요 .

[noexcept] bool operator<(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhs 이터레이터가 가리키는 항목이 rhs 이터레이터가 가리키는 항목보다 작으면 true 을 반환합니다.

[noexcept] bool operator<=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhs 이터레이터가 가리키는 항목이 rhs 이터레이터가 가리키는 항목보다 작거나 같으면 true 을 반환합니다.

[noexcept] bool operator==(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhsrhs 이터레이터와 동일한 항목을 가리키면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

operator!=()도 참조하세요 .

[noexcept] bool operator>(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhs 이터레이터가 가리키는 항목이 rhs 이터레이터가 가리키는 항목보다 크면 true 을 반환합니다.

[noexcept] bool operator>=(const QJsonArray::const_iterator &lhs, const QJsonArray::const_iterator &rhs)

lhs 이터레이터가 가리키는 항목이 rhs 이터레이터가 가리키는 항목보다 크거나 같으면 true 을 반환합니다.

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.