Add comments on confusing "simdjson_unused"

This commit is contained in:
John Keiser 2021-02-22 09:39:09 -08:00
parent bcab8d3abf
commit cdb607f202
2 changed files with 4 additions and 0 deletions

View File

@ -46,6 +46,8 @@ simdjson_really_inline array::array(const value_iterator &_iter) noexcept
}
simdjson_really_inline simdjson_result<array> array::start(value_iterator &iter) noexcept {
// We don't need to know if the array is empty to start iteration, but we do want to know if there
// is an error--thus `simdjson_unused`.
simdjson_unused bool has_value;
SIMDJSON_TRY( iter.start_array().get(has_value) );
return array(iter);

View File

@ -34,6 +34,8 @@ simdjson_really_inline simdjson_result<value> object::find_field(const std::stri
}
simdjson_really_inline simdjson_result<object> object::start(value_iterator &iter) noexcept {
// We don't need to know if the object is empty to start iteration, but we do want to know if there
// is an error--thus `simdjson_unused`.
simdjson_unused bool has_value;
SIMDJSON_TRY( iter.start_object().get(has_value) );
return object(iter);