From 243bcf6a6d678fbf6a5d13935e6f77e571836f3e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 27 Dec 2016 21:52:53 +0000 Subject: Support set -add on flag types Fixes #1082 --- src/enum.hh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/enum.hh') diff --git a/src/enum.hh b/src/enum.hh index 6f4a4bdb..01f89b32 100644 --- a/src/enum.hh +++ b/src/enum.hh @@ -73,6 +73,15 @@ EnableIfWithoutBitOps option_from_string(StringView str, Enum& e) e = it->value; } +template +EnableIfWithBitOps option_add(Flags& opt, StringView str) +{ + Flags res = Flags{}; + option_from_string(str, res); + opt |= res; + return res != (Flags)0; +} + } #endif // enum_hh_INCLUDED -- cgit v1.2.3