Hmmm.... I see the problem. How asinine to make the bitset size controlled by a template parameter.
I think you could go down two roads.
First, you could store your bits in the string exclusively and return a specific bitset when asked:
template <int bsize>
bitset<bsize> getBits()
{
return bitset<bsize> bits( s );
}
I would personally favor using a
vector<bool>. Of course, you'll have to implement your own logic. This would provide all the extensibility you would need.