From b2073da6041e5bcc61315fa76eb02f4632f4fbcd Mon Sep 17 00:00:00 2001 From: janis Date: Thu, 11 Aug 2022 08:19:28 +0100 Subject: [PATCH] added enum contains functoin --- include/enum.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/enum.hpp b/include/enum.hpp index 5cb8414..eedacdb 100644 --- a/include/enum.hpp +++ b/include/enum.hpp @@ -53,6 +53,11 @@ template constexpr auto is_empty(const E &value) -> bool { return std::to_underlying(value) == 0; } +template +constexpr auto contains(const E &lhs, const E &rhs) -> bool { + return std::to_underlying(lhs & rhs) != 0; +} + } // namespace bitflag_operators using bitflag_operators::enum_type;