Skip to content

Commit f126dba

Browse files
committed
Common: EnumFlags turn set with empty string into reset
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 5a7fba3 commit f126dba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Common/Utils/include/CommonUtils/EnumFlags.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,14 @@ class EnumFlags
398398
// Sets flags from a string representation.
399399
// This can be either from a number representation (binary or digits) or
400400
// a concatenation of the enums members name e.g., 'Enum1|Enum2|...'
401-
void set(const std::string& s, int base = 2)
401+
void set(const std::string& s = "", int base = 2)
402402
{
403403
// on throw restore previous state and rethrow
404404
const U prev = mBits;
405405
reset();
406+
if (s.empty()) { // no-op
407+
return;
408+
}
406409
try {
407410
setImpl(s, base);
408411
} catch (const std::exception& e) {

0 commit comments

Comments
 (0)