c++ - Define bitset size at initialization? -


i want make bitset in c++. did bit of research. examples found this:

bitset<6> mybitset; // 

but don't know size of bitset when define variable in class:

#include <bitset> class test { public:      std::bitset *mybitset; } 

this won't compile...

and initializing doesn't work:

int size = getdependentsizeforbitset(); mybitset = new bitset<size>(); 

boost has dynamic_bitset can use.

alternatively, can use vector<bool>, (unfortunately) specialized act bitset. causes lot of confusion, , in general considered bad idea. that's how works, if that's need, might use it, suppose.


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -