Require iterators to finish cleanly and release

This commit is contained in:
John Keiser 2020-08-31 13:02:05 -07:00
parent 44268b0c6b
commit bd190af7a3
1 changed files with 4 additions and 1 deletions

View File

@ -282,7 +282,10 @@ simdjson_really_inline json_iterator_ref::json_iterator_ref(json_iterator *_iter
: iter{_iter}
{
}
simdjson_really_inline json_iterator_ref::~json_iterator_ref() noexcept = default;
simdjson_really_inline json_iterator_ref::~json_iterator_ref() noexcept {
// The caller MUST consume their value and release the iterator before they die
SIMDJSON_ASSUME(!iter);
}
simdjson_really_inline json_iterator_ref json_iterator_ref::borrow() noexcept {
return json_iterator_ref(iter);