I want to know if there is more "official" or efficient way to create a dynamic_bitset from any raw data. I am not good with template code, but as far as I can tell there isn't class constructor for my use case. So I have written this piece of code:
What do you think? How do you do it?PHP Code:.....
unsigned int length(ehave->string_length());
char const* first = ehave->string_ptr();
boost::dynamic_bitset<> array(length*8);
for (unsigned int i=0; i<length; i++)
{
char const* byte = first+i;
for (unsigned int a=0; a<8; a++)
array[a + i*8] = (*byte & (1<<(a)));
}
.....



Adv Reply
Bookmarks