r/cpp • u/meetingcpp Meeting C++ | C++ Evangelist • Jul 19 '26
A better bitset for enum flags
https://www.elbeno.com/blog/?p=1836
43
Upvotes
r/cpp • u/meetingcpp Meeting C++ | C++ Evangelist • Jul 19 '26
View all comments
Show parent comment
2
u/Brisngr368 Jul 21 '26 edited Jul 21 '26
Couldn't you define operators for the struct so like '|=' etc to try and simplify this somewhat.
Maybe implement it so you can OR bitfields together and such by overloading the | operator, so you can use the bitfields how you would like to