Garmaine Staff asked 4 years ago

I want to make a bitset in C++. I did a bit of research. All examples I found where like this:

bitset<6> myBitset;
// do something with it

But I don't know the size of the bitset when I define the variable in my class:

#include <bitset>
class Test
{
public:
     std::bitset *myBitset;
}

This won't compile…

And initializing like this also doesn't work:

int size = getDependentSizeForBitset();
myBitset = new bitset<size>();