Define bitset size at initialization?

Boost has a dynamic_bitset you can use.

Alternatively, you can use a vector<bool>, which (unfortunately) is specialized to act as a bitset. This causes a lot of confusion, and in general is considered a bad idea. But that’s how it works, so if that’s what you need, you might as well use it, I suppose.

Leave a Comment