diff --git a/include/simdjson/generic/ondemand/array_iterator-inl.h b/include/simdjson/generic/ondemand/array_iterator-inl.h index 8d5608896..ecc1f0635 100644 --- a/include/simdjson/generic/ondemand/array_iterator-inl.h +++ b/include/simdjson/generic/ondemand/array_iterator-inl.h @@ -19,11 +19,11 @@ simdjson_really_inline simdjson_result array_iterator::operator*() noe return value::start(iter->borrow_iterator()); } template -simdjson_really_inline bool array_iterator::operator==(const array_iterator &other) noexcept { +simdjson_really_inline bool array_iterator::operator==(const array_iterator &other) const noexcept { return !(*this != other); } template -simdjson_really_inline bool array_iterator::operator!=(const array_iterator &) noexcept { +simdjson_really_inline bool array_iterator::operator!=(const array_iterator &) const noexcept { return iter->is_iterator_alive(); } template @@ -62,12 +62,12 @@ simdjson_really_inline simdjson_result return *this->first; } template -simdjson_really_inline bool simdjson_result>::operator==(const simdjson_result> &other) noexcept { +simdjson_really_inline bool simdjson_result>::operator==(const simdjson_result> &other) const noexcept { if (this->error()) { return true; } return this->first == other.first; } template -simdjson_really_inline bool simdjson_result>::operator!=(const simdjson_result> &other) noexcept { +simdjson_really_inline bool simdjson_result>::operator!=(const simdjson_result> &other) const noexcept { if (this->error()) { return false; } return this->first != other.first; } diff --git a/include/simdjson/generic/ondemand/array_iterator.h b/include/simdjson/generic/ondemand/array_iterator.h index b4cba38bd..6fa21c43d 100644 --- a/include/simdjson/generic/ondemand/array_iterator.h +++ b/include/simdjson/generic/ondemand/array_iterator.h @@ -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 &) noexcept; + simdjson_really_inline bool operator==(const array_iterator &) 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 &) noexcept; + simdjson_really_inline bool operator!=(const array_iterator &) const noexcept; /** * Move to the next element. * @@ -91,8 +91,8 @@ public: // simdjson_really_inline simdjson_result operator*() noexcept; // MUST ONLY BE CALLED ONCE PER ITERATION. - simdjson_really_inline bool operator==(const simdjson_result> &) noexcept; - simdjson_really_inline bool operator!=(const simdjson_result> &) noexcept; + simdjson_really_inline bool operator==(const simdjson_result> &) const noexcept; + simdjson_really_inline bool operator!=(const simdjson_result> &) const noexcept; simdjson_really_inline simdjson_result> &operator++() noexcept; }; diff --git a/include/simdjson/generic/ondemand/object_iterator-inl.h b/include/simdjson/generic/ondemand/object_iterator-inl.h index e44f9f238..ad389f4f0 100644 --- a/include/simdjson/generic/ondemand/object_iterator-inl.h +++ b/include/simdjson/generic/ondemand/object_iterator-inl.h @@ -17,10 +17,10 @@ simdjson_really_inline simdjson_result 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 return *first; } // Assumes it's being compared with the end. true if depth < iter->depth. -simdjson_really_inline bool simdjson_result::operator==(const simdjson_result &other) noexcept { +simdjson_really_inline bool simdjson_result::operator==(const simdjson_result &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::operator!=(const simdjson_result &other) noexcept { +simdjson_really_inline bool simdjson_result::operator!=(const simdjson_result &other) const noexcept { if (error()) { return false; } return first != other.first; } diff --git a/include/simdjson/generic/ondemand/object_iterator.h b/include/simdjson/generic/ondemand/object_iterator.h index 43f51bd48..cf3670f76 100644 --- a/include/simdjson/generic/ondemand/object_iterator.h +++ b/include/simdjson/generic/ondemand/object_iterator.h @@ -26,9 +26,9 @@ public: // MUST ONLY BE CALLED ONCE PER ITERATION. simdjson_really_inline simdjson_result 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 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 &) noexcept; + simdjson_really_inline bool operator==(const simdjson_result &) const noexcept; // Assumes it's being compared with the end. true if depth >= iter->depth. - simdjson_really_inline bool operator!=(const simdjson_result &) noexcept; + simdjson_really_inline bool operator!=(const simdjson_result &) const noexcept; // Checks for ']' and ',' simdjson_really_inline simdjson_result &operator++() noexcept; };