A
Alexandros
Can anyone tell me how to convert several bits stored in a vectro<bool>
to bytes (char)?
for example:
vector<bool> v;
v.reserve(8);
v.push_back(0);
v.push_back(0);
v.push_back(0);
v.push_back(0);
v.push_back(1);
v.push_back(0);
v.push_back(0);
v.push_back(0);
and now I want to get
char* c = static_cast<char*>(v.begin());
so that
c[0] == 8;
that above doesn't work. How can I do it?
Is there any funcion "toByte()" or sth like that?
thanks.
to bytes (char)?
for example:
vector<bool> v;
v.reserve(8);
v.push_back(0);
v.push_back(0);
v.push_back(0);
v.push_back(0);
v.push_back(1);
v.push_back(0);
v.push_back(0);
v.push_back(0);
and now I want to get
char* c = static_cast<char*>(v.begin());
so that
c[0] == 8;
that above doesn't work. How can I do it?
Is there any funcion "toByte()" or sth like that?
thanks.