C
continuation.nomad
suppose I have a large byte array which is actually a bit array. I
want to put this into a vector<bool>. What is the most efficient
way? Internally I know a vector<bool> is represented as a byte array,
so I really would just like a function that says "here's the bytes,
just copy the data". It could even do a memcpy for efficiency. Is
this possible? I've been toying around with it a bit, and it seems
like it might not be possible, and that I actually have to loop
through every single item setting bits. I've tried memcpying to &vec
[0] as well, still no luck.
want to put this into a vector<bool>. What is the most efficient
way? Internally I know a vector<bool> is represented as a byte array,
so I really would just like a function that says "here's the bytes,
just copy the data". It could even do a memcpy for efficiency. Is
this possible? I've been toying around with it a bit, and it seems
like it might not be possible, and that I actually have to loop
through every single item setting bits. I've tried memcpying to &vec
[0] as well, still no luck.