https://bugs.documentfoundation.org/show_bug.cgi?id=168771
--- Comment #3 from Tomaz Vajngerl <[email protected]> --- Note that instead of bit flags and messing with bitwise operators it's IMHO more straight forward to just declare a struct with 1-bit long booleans, which AFAIK should be pretty similar to bit flags but the compiler would do all the work. For example: enum class FileViewFlags { None = 0x00, MultiSelection = 0x02, ShowType = 0x04, ShowNone = 0x20, }; instead you could use struct FileViewFlags { bool bMultiSelection : 1 = false; bool bShowType : 1 = false; bool bShowNone : 1 = false; }; and... FileViewFlags eFlags = FileViewFlags::MultiSelection | FileViewFlags::ShowType; if (eFlags & FileViewFlags::MultiSelection) ... eFlags |= ShowType; you can do: FileViewFlags aFlags { .bMultiSelection = true, bShowType = true } if (aFlags.bMultiSelection) ... aFlags.bShowType = true; if checking for "None" or in some cases "All" (or various other variations=, you can just add a isNone() or isAll() function. Then you check with: if (eFlags & FileViewFlags::None) vs. if (aFlags.isNone()) or provide a static method FileViewFlags::None(), which is essentially just a shortcut for FileViewFlags(), FileViewFlags::All() would then be a short-cut for FileViewFlags aFlags { .bMultiSelection = true, bShowType = true, bShowNone = true }. then: if (aFlags == FileViewFlags::All()) and if (aFlags == FileViewFlags::None()) would work. I think this is just less error prone than doing bitwise operations (especially when you want to set and unset bits it could become quite crappy) -- You are receiving this mail because: You are the assignee for the bug.
