! @brief comparison: equal @pre The iterator is initialized; i.e. `m_object != nullptr`. */
| 11163 | @pre The iterator is initialized; i.e. `m_object != nullptr`. |
| 11164 | */ |
| 11165 | bool operator==(const iter_impl& other) const |
| 11166 | { |
| 11167 | // if objects are not the same, the comparison is undefined |
| 11168 | if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object)) |
| 11169 | { |
| 11170 | JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers")); |
| 11171 | } |
| 11172 | |
| 11173 | JSON_ASSERT(m_object != nullptr); |
| 11174 | |
| 11175 | switch (m_object->m_type) |
| 11176 | { |
| 11177 | case value_t::object: |
| 11178 | return (m_it.object_iterator == other.m_it.object_iterator); |
| 11179 | |
| 11180 | case value_t::array: |
| 11181 | return (m_it.array_iterator == other.m_it.array_iterator); |
| 11182 | |
| 11183 | default: |
| 11184 | return (m_it.primitive_iterator == other.m_it.primitive_iterator); |
| 11185 | } |
| 11186 | } |
| 11187 | |
| 11188 | /*! |
| 11189 | @brief comparison: not equal |