Anycorn Anycorn - 1 year ago 263
C Question

C/C++ efficient bit array

Can you recommend efficient/clean way to manipulate arbitrary length bit array?
right now I am using regular int/char bitmask, but those are not very clean when array length is greater than datatype length.

std vector<bool>
is not available for me.


Answer Source

boost::dynamic_bitset if the length is only known in run time.

std::bitset if the length is known in compile time (although arbitrary).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download