I want to create an array of dynamic_bitsets. So I created a vector of dynamic_bitset using,
vector<boost::dynamic_bitset<>> v;
How can I specify the size of each of these dynamic_bitsets i.e. v[0], v[1] etc? Like in a general case, we specify the size through the constructor.
boost::dynamic_bitset<> x(3);
This line
create an empty vector. Instead you could have requested it be filled with default entries which all have the same value, so like one usually does
to create a vector with
Nentries all 1 you could doto have it contain
Nboost::dynamic_bitset<>s with 3 bits.If your vector contains enough elements you should be able to set the
v[i]to a different sizeAlternative you could create an empty vector like you currently do and just use something like
v.push_back(boost::dynamic_bitset<>(42))to add correctly sized elements.