That is what I was afraid of. No way to define a bitset based on a
random memory buffer. I saw how you could define it as string, but
that will not help me. Strangly, I just wrote a test program similar
to yours before I read your response. I used unsigned char instead of
unsigned longs though because my data is byte aligned not 4 byte
aligned. I may change that though so I can load 4 bytes at a time
instead of 1 byte at a time.
1 #include <iostream>
2 #include <bitset>
3
4 int main(){
5 int const size = 256;
6 unsigned char* data = new unsigned char[size/8];
7 unsigned char* dataBegin = data;
8 *(data) = 0xEA;
9 *(data+1) = 0x1;
10 *(data+

= 0xFF;
11 std::bitset<size> bits;
12 for(int i=0; i<size/8; ++i){
13 bits <<= 8;
14 bits |= std::bitset<size>(*data);
15 ++data;
16 }
17 std::cout<<bits.count()<<std::endl;
18 std::cout<<bits<<std::endl;
19 delete[] dataBegin;
20 return 0;
21 }