parent
6d3842af5b
commit
243bcf6a6d
|
@ -73,6 +73,15 @@ EnableIfWithoutBitOps<Enum> option_from_string(StringView str, Enum& e)
|
||||||
e = it->value;
|
e = it->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Flags, typename = decltype(enum_desc(Flags{}))>
|
||||||
|
EnableIfWithBitOps<Flags, bool> option_add(Flags& opt, StringView str)
|
||||||
|
{
|
||||||
|
Flags res = Flags{};
|
||||||
|
option_from_string(str, res);
|
||||||
|
opt |= res;
|
||||||
|
return res != (Flags)0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // enum_hh_INCLUDED
|
#endif // enum_hh_INCLUDED
|
||||||
|
|
|
@ -214,8 +214,7 @@ inline bool option_add(StronglyTypedNumber<RealType, ValueType>& opt,
|
||||||
return val != 0;
|
return val != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
inline bool option_add(...)
|
||||||
bool option_add(T&, StringView str)
|
|
||||||
{
|
{
|
||||||
throw runtime_error("no add operation supported for this option type");
|
throw runtime_error("no add operation supported for this option type");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user