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 diff --git a/src/option_types.hh b/src/option_types.hh index b0d9b054..3b5799dd 100644 --- a/src/option_types.hh +++ b/src/option_types.hh @@ -214,8 +214,7 @@ inline bool option_add(StronglyTypedNumber& opt, return val != 0; } -template -bool option_add(T&, StringView str) +inline bool option_add(...) { throw runtime_error("no add operation supported for this option type"); }