Avoid O(n) search in EnumType::Lookup

This commit is contained in:
Tim Wojtulewicz 2025-04-02 12:46:01 -07:00
parent 28fd2a7a7a
commit c22e54604f
2 changed files with 14 additions and 21 deletions

View file

@ -863,8 +863,8 @@ protected:
void DoDescribe(ODesc* d) const override;
using NameMap = std::map<std::string, zeek_int_t>;
NameMap names;
std::map<std::string, zeek_int_t> names;
std::map<zeek_int_t, std::string> rev_names;
// Whether any of the elements of the enum were added via redef's.
bool has_redefs = false;