! @brief comparison: smaller @pre The iterator is initialized; i.e. `m_object != nullptr`. */
| 11199 | @pre The iterator is initialized; i.e. `m_object != nullptr`. |
| 11200 | */ |
| 11201 | bool operator<(const iter_impl& other) const |
| 11202 | { |
| 11203 | // if objects are not the same, the comparison is undefined |
| 11204 | if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object)) |
| 11205 | { |
| 11206 | JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers")); |
| 11207 | } |
| 11208 | |
| 11209 | JSON_ASSERT(m_object != nullptr); |
| 11210 | |
| 11211 | switch (m_object->m_type) |
| 11212 | { |
| 11213 | case value_t::object: |
| 11214 | JSON_THROW(invalid_iterator::create(213, "cannot compare order of object iterators")); |
| 11215 | |
| 11216 | case value_t::array: |
| 11217 | return (m_it.array_iterator < other.m_it.array_iterator); |
| 11218 | |
| 11219 | default: |
| 11220 | return (m_it.primitive_iterator < other.m_it.primitive_iterator); |
| 11221 | } |
| 11222 | } |
| 11223 | |
| 11224 | /*! |
| 11225 | @brief comparison: less than or equal |