Implement standard-library-compatible iterators for Dictionary

This commit is contained in:
Tim Wojtulewicz 2020-09-22 13:59:13 -07:00
parent 9e9998c6e5
commit 892124378c
16 changed files with 834 additions and 254 deletions

View file

@ -927,14 +927,12 @@ broker::expected<broker::data> val_to_data(const Val* v)
else
rval = broker::table();
zeek::detail::HashKey* hk;
TableEntryVal* entry;
auto c = table->InitForIteration();
while ( (entry = table->NextEntry(hk, c)) )
for ( const auto& te : *table )
{
auto hk = te.GetHashKey();
auto* entry = te.GetValue<TableEntryVal*>();
auto vl = table_val->RecreateIndex(*hk);
delete hk;
broker::vector composite_key;
composite_key.reserve(vl->Length());