m[set/map] Add operator bool()

Probably should use in places..
This commit is contained in:
Behdad Esfahbod 2020-06-28 22:41:09 -07:00
parent bf75a0a03a
commit 2fbd34f89a
2 changed files with 2 additions and 0 deletions

View File

@ -177,6 +177,7 @@ struct hb_hashmap_t
}
bool is_empty () const { return population == 0; }
explicit operator bool () const { return !is_empty (); }
unsigned int get_population () const { return population; }

View File

@ -273,6 +273,7 @@ struct hb_set_t
return false;
return true;
}
explicit operator bool () const { return !is_empty (); }
void dirty () { population = UINT_MAX; }