-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
the vector is defined private in the .h file. Any help will be much appreciated.
something has got to be wrong with the vector, or how I am trying to get it into the other functions, although I do not know what. Trying to print the vector in another makes the program die exactly at the time of trying to access the vector:
Program terminated with signal 11, Segmentation fault. #0 operator bool (this=<optimized out>) at /usr/include/c++/4.7/bits/stl_bvector.h:82 82 { return !!(*_M_p & _M_mask); } (gdb) bt #0 operator bool (this=<optimized out>) at /usr/include/c++/4.7/bits/stl_bvector.h:82 #1 operator* (this=<optimized out>) at /usr/include/c++/4.7/bits/stl_bvector.h:288 #2 operator[] (__n=0, this=<optimized out>) at /usr/include/c++/4.7/bits/stl_bvector.h:712 #3 ldu1::lcf (this=0xaf702010) at ldu1.cc:137 //print statement location #4 0xb2d4ea01 in ldu1::snapshot (this=0xaf702010) at ldu1.cc:102 #5 0xb2d539ab in snapshot_du_handler::handle (this=0xa8ffcf0, du=...) at snapshot_du_handler.cc:44 #6 0xaf703aa4 in ?? ()
here is the function where the print is located: uint16_t ldu1::lcf() const { int i; uint16_t lcf; printf("\n LCF: "); for(i=0; i<8; i++) cout << decoded_lcw_vec[i]; for(i=0; i<8; i++) lcf = decoded_lcw_vec[i]; return lcf;
}
Some say vector<bool> is buggy and cannot be trusted but I see it works well in the rest of the program. How can I safely get the vector from one function to another without putting it in as a function parameter?