mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
Implement standard-library-compatible iterators for Dictionary
This commit is contained in:
parent
9e9998c6e5
commit
892124378c
16 changed files with 834 additions and 254 deletions
|
@ -77,16 +77,12 @@ void Reporter::InitOptions()
|
|||
auto wl_val = id::find_val(name)->AsTableVal();
|
||||
auto wl_table = wl_val->AsTable();
|
||||
|
||||
detail::HashKey* k;
|
||||
IterCookie* c = wl_table->InitForIteration();
|
||||
TableEntryVal* v;
|
||||
|
||||
while ( (v = wl_table->NextEntry(k, c)) )
|
||||
for ( const auto& wle : *wl_table )
|
||||
{
|
||||
auto k = wle.GetHashKey();
|
||||
auto index = wl_val->RecreateIndex(*k);
|
||||
std::string key = index->Idx(0)->AsString()->CheckString();
|
||||
set->emplace(move(key));
|
||||
delete k;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue