Define bitset size at initialization?
Use Boost::dynamic_bitset
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.