Dear community,
I cannot figure out how to debug into a STL vector so I am asking for help by this post.
I am using the STL vector in a project and during runtime I'd like to inspect the values inside the vector. Hence the only thing I can see in the debugging window is something like:
Value of v: {<_Vector_base<double,std::allocator<double> >> = {
_M_impl = {<allocator<double>> = {<new_allocator<double>> = {<No data fields>}, <No data fields>}, _M_start = 0x3e2cf8, _M_finish = 0x3e2d10, _M_end_of_storage = 0x3e2d18}}, <No data fields>}
but no values. I tried different things but I don't know how to actually display the values of the vector. Can somebody help? Here is a short code-snippet to give a try:
#include <iostream>
#include <vector>
int main()
{
std::vector<double> v;
v.push_back(1.1); v.push_back(2.2); v.push_back(3.3);
for (unsigned int i=0; i<v.size(); i++)
std::cout << "| " << v.at(i) << " |" << std::endl;
return 0;
}
I must admit that until now I have used DDD for debugging my code and I am using the C::B GDB plugin just for a short time so there might be a very simple answer... (I hope so)...?!
Thanks, Morten.