J
JoeC
I am loading a BYTE array into a vector in an object. Then I want to
reverse the order of the array in the vector.
static
BYTE Bits[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,
....
cbm2 = new colorBitmap(Bits,16*16,colors, 12);
colorBitmap::colorBitmap(BYTE * b, int n1, BYTE* rgb, int n2){
int lp;
create();
for(lp = 0; lp != n1; lp++)
bitData.push_back(*b++);
void colorBitmap::flipBitmap(){
std::vector<BYTE>temp;
for(int lp = 0; lp != bitData.size();lp++) <-Fails
temp.push_back(bitData[lp]);
bitData.clear();
for(int lp = bitData.size(); lp !=0; lp--)
bitData.push_back(temp[lp]);
copy(bitData.end(), bitData.begin(), back_inserter(temp)); Fails
as well.
What can I do to work with a vector in a way the program will not
crash?
reverse the order of the array in the vector.
static
BYTE Bits[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,
....
cbm2 = new colorBitmap(Bits,16*16,colors, 12);
colorBitmap::colorBitmap(BYTE * b, int n1, BYTE* rgb, int n2){
int lp;
create();
for(lp = 0; lp != n1; lp++)
bitData.push_back(*b++);
void colorBitmap::flipBitmap(){
std::vector<BYTE>temp;
for(int lp = 0; lp != bitData.size();lp++) <-Fails
temp.push_back(bitData[lp]);
bitData.clear();
for(int lp = bitData.size(); lp !=0; lp--)
bitData.push_back(temp[lp]);
copy(bitData.end(), bitData.begin(), back_inserter(temp)); Fails
as well.
What can I do to work with a vector in a way the program will not
crash?