Update value_iterator-inl.h

This commit is contained in:
John Keiser 2021-02-22 09:34:20 -08:00 committed by GitHub
parent c4a312e6c3
commit a755203aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -510,6 +510,7 @@ simdjson_really_inline bool value_iterator::is_at_container_start() const noexce
return _json_iter->token.index == _start_position + 1;
}
simdjson_really_inline bool value_iterator::is_at_iterator_start() const noexcept {
// We can legitimately be either at the first value ([1]), or after the array if it's empty ([]).
auto delta = _json_iter->token.index - _start_position;
return delta == 1 || delta == 2;
}
@ -567,4 +568,4 @@ simdjson_really_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::value_
simdjson_really_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::value_iterator>::simdjson_result(error_code error) noexcept
: implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::value_iterator>(error) {}
} // namespace simdjson
} // namespace simdjson