From 2fbd34f89a80fb25aa0f8edd1dbb692c66211842 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 28 Jun 2020 22:41:09 -0700 Subject: [PATCH] m[set/map] Add operator bool() Probably should use in places.. --- src/hb-map.hh | 1 + src/hb-set.hh | 1 + 2 files changed, 2 insertions(+) diff --git a/src/hb-map.hh b/src/hb-map.hh index 82fa3ccf8..84fe1d549 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -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; } diff --git a/src/hb-set.hh b/src/hb-set.hh index 3b100f609..ae8b5eb10 100644 --- a/src/hb-set.hh +++ b/src/hb-set.hh @@ -273,6 +273,7 @@ struct hb_set_t return false; return true; } + explicit operator bool () const { return !is_empty (); } void dirty () { population = UINT_MAX; }