dimanche 6 décembre 2020

Auto resizing the dynamic_bitset

So I have a vector of numbers, example 4, 20, 1500, 4, 270. The first element will occupy 3 bits, second 5 bits, 3rd 11 bits and so on. How do I set the bit_size to automatically change according to the number of bits the element will occupy? Like,

int bit_size = 4; 
boost::dynamic_bitset<> B(bit_size, 4);

Aucun commentaire:

Enregistrer un commentaire