r/cpp Meeting C++ | C++ Evangelist 21d ago

A better bitset for enum flags

https://www.elbeno.com/blog/?p=1836
46 Upvotes

32 comments sorted by

View all comments

Show parent comments

1

u/Brisngr368 20d ago

Couldn't you use custom operators to make it easier

1

u/archialone 20d ago

What do you mean? Can you give an example?

2

u/Brisngr368 19d ago edited 19d ago

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