mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 05:58:20 +00:00
use std::find_if rather than explicit loop
This commit is contained in:
parent
d609a11312
commit
c10737d168
1 changed files with 5 additions and 5 deletions
|
@ -55,12 +55,12 @@ const TypeInfo& find_type_info(ZAM_ExprType et)
|
|||
{
|
||||
assert(et != ZAM_EXPR_TYPE_NONE);
|
||||
|
||||
for ( auto& ti : ZAM_type_info )
|
||||
if ( ti.et == et )
|
||||
return ti;
|
||||
auto pred = [et] (const TypeInfo& ti) -> bool { return ti.et == et; };
|
||||
auto ti = std::find_if(ZAM_type_info.begin(), ZAM_type_info.end(),
|
||||
pred);
|
||||
|
||||
assert(false);
|
||||
return ZAM_type_info[0];
|
||||
assert(ti != ZAM_type_info.end());
|
||||
return *ti;
|
||||
}
|
||||
|
||||
// Given a ZAM_ExprType, return its ZVal accessor. Takes into account
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue