From daaf89a1a154e32a5394580224cdc7761e428ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 19 Jul 2012 23:34:30 +0200 Subject: [PATCH] Added (explicit) operator bool to Set. So things like if(!(set & Enum::Value)) are possible. --- src/Set.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Set.h b/src/Set.h index 5a9c04c67..c693c8a33 100644 --- a/src/Set.h +++ b/src/Set.h @@ -81,6 +81,11 @@ template class Set { return Set(~value); } + /** @brief Value as boolean */ + inline constexpr explicit operator bool() const { + return value == 0; + } + /** @brief Value in underlying type */ inline constexpr explicit operator UnderlyingType() const { return value;