mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
Mark comparison operators as const (#1320)
Co-authored-by: Mikhail Matrosov <mikhail.matrosov@aimtech.com>
This commit is contained in:
@@ -19,11 +19,11 @@ simdjson_really_inline simdjson_result<value> array_iterator<T>::operator*() noe
|
||||
return value::start(iter->borrow_iterator());
|
||||
}
|
||||
template<typename T>
|
||||
simdjson_really_inline bool array_iterator<T>::operator==(const array_iterator<T> &other) noexcept {
|
||||
simdjson_really_inline bool array_iterator<T>::operator==(const array_iterator<T> &other) const noexcept {
|
||||
return !(*this != other);
|
||||
}
|
||||
template<typename T>
|
||||
simdjson_really_inline bool array_iterator<T>::operator!=(const array_iterator<T> &) noexcept {
|
||||
simdjson_really_inline bool array_iterator<T>::operator!=(const array_iterator<T> &) const noexcept {
|
||||
return iter->is_iterator_alive();
|
||||
}
|
||||
template<typename T>
|
||||
@@ -62,12 +62,12 @@ simdjson_really_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::value>
|
||||
return *this->first;
|
||||
}
|
||||
template<typename T>
|
||||
simdjson_really_inline bool simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>>::operator==(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>> &other) noexcept {
|
||||
simdjson_really_inline bool simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>>::operator==(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>> &other) const noexcept {
|
||||
if (this->error()) { return true; }
|
||||
return this->first == other.first;
|
||||
}
|
||||
template<typename T>
|
||||
simdjson_really_inline bool simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>>::operator!=(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>> &other) noexcept {
|
||||
simdjson_really_inline bool simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>>::operator!=(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>> &other) const noexcept {
|
||||
if (this->error()) { return false; }
|
||||
return this->first != other.first;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
*
|
||||
* @return true if there are no more elements in the JSON array.
|
||||
*/
|
||||
simdjson_really_inline bool operator==(const array_iterator<T> &) noexcept;
|
||||
simdjson_really_inline bool operator==(const array_iterator<T> &) const noexcept;
|
||||
/**
|
||||
* Check if there are more elements in the JSON array.
|
||||
*
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
*
|
||||
* @return true if there are more elements in the JSON array.
|
||||
*/
|
||||
simdjson_really_inline bool operator!=(const array_iterator<T> &) noexcept;
|
||||
simdjson_really_inline bool operator!=(const array_iterator<T> &) const noexcept;
|
||||
/**
|
||||
* Move to the next element.
|
||||
*
|
||||
@@ -91,8 +91,8 @@ public:
|
||||
//
|
||||
|
||||
simdjson_really_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::value> operator*() noexcept; // MUST ONLY BE CALLED ONCE PER ITERATION.
|
||||
simdjson_really_inline bool operator==(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>> &) noexcept;
|
||||
simdjson_really_inline bool operator!=(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>> &) noexcept;
|
||||
simdjson_really_inline bool operator==(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>> &) const noexcept;
|
||||
simdjson_really_inline bool operator!=(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>> &) const noexcept;
|
||||
simdjson_really_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator<T>> &operator++() noexcept;
|
||||
};
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ simdjson_really_inline simdjson_result<field> object_iterator::operator*() noexc
|
||||
if (result.error()) { iter->release(); }
|
||||
return result;
|
||||
}
|
||||
simdjson_really_inline bool object_iterator::operator==(const object_iterator &other) noexcept {
|
||||
simdjson_really_inline bool object_iterator::operator==(const object_iterator &other) const noexcept {
|
||||
return !(*this != other);
|
||||
}
|
||||
simdjson_really_inline bool object_iterator::operator!=(const object_iterator &) noexcept {
|
||||
simdjson_really_inline bool object_iterator::operator!=(const object_iterator &) const noexcept {
|
||||
return iter->is_alive();
|
||||
}
|
||||
simdjson_really_inline object_iterator &object_iterator::operator++() noexcept {
|
||||
@@ -55,12 +55,12 @@ simdjson_really_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::field>
|
||||
return *first;
|
||||
}
|
||||
// Assumes it's being compared with the end. true if depth < iter->depth.
|
||||
simdjson_really_inline bool simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::operator==(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &other) noexcept {
|
||||
simdjson_really_inline bool simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::operator==(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &other) const noexcept {
|
||||
if (error()) { return true; }
|
||||
return first == other.first;
|
||||
}
|
||||
// Assumes it's being compared with the end. true if depth >= iter->depth.
|
||||
simdjson_really_inline bool simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::operator!=(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &other) noexcept {
|
||||
simdjson_really_inline bool simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::operator!=(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &other) const noexcept {
|
||||
if (error()) { return false; }
|
||||
return first != other.first;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ public:
|
||||
// MUST ONLY BE CALLED ONCE PER ITERATION.
|
||||
simdjson_really_inline simdjson_result<field> operator*() noexcept;
|
||||
// Assumes it's being compared with the end. true if depth < iter->depth.
|
||||
simdjson_really_inline bool operator==(const object_iterator &) noexcept;
|
||||
simdjson_really_inline bool operator==(const object_iterator &) const noexcept;
|
||||
// Assumes it's being compared with the end. true if depth >= iter->depth.
|
||||
simdjson_really_inline bool operator!=(const object_iterator &) noexcept;
|
||||
simdjson_really_inline bool operator!=(const object_iterator &) const noexcept;
|
||||
// Checks for ']' and ','
|
||||
simdjson_really_inline object_iterator &operator++() noexcept;
|
||||
private:
|
||||
@@ -61,9 +61,9 @@ public:
|
||||
// Reads key and value, yielding them to the user.
|
||||
simdjson_really_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::field> operator*() noexcept; // MUST ONLY BE CALLED ONCE PER ITERATION.
|
||||
// Assumes it's being compared with the end. true if depth < iter->depth.
|
||||
simdjson_really_inline bool operator==(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &) noexcept;
|
||||
simdjson_really_inline bool operator==(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &) const noexcept;
|
||||
// Assumes it's being compared with the end. true if depth >= iter->depth.
|
||||
simdjson_really_inline bool operator!=(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &) noexcept;
|
||||
simdjson_really_inline bool operator!=(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &) const noexcept;
|
||||
// Checks for ']' and ','
|
||||
simdjson_really_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &operator++() noexcept;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user