[core] operator bool() must always be explicit

Otherwise, it can participate in unexpected conversions. Case in point: GlyphSet::insert was comparing the result of GlyphMetrics::operator bool() where it wanted to use operator==.
This commit is contained in:
John Firebaugh
2016-10-28 14:55:07 -07:00
parent ee3235708f
commit a4c82b8a3b
3 changed files with 13 additions and 5 deletions

View File

@@ -13,7 +13,7 @@ public:
constexpr Size(const uint32_t width_, const uint32_t height_) : width(width_), height(height_) {
}
constexpr operator bool() const {
constexpr explicit operator bool() const {
return width > 0 && height > 0;
}