This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Cannot subscript vector<vector<T> > in gdb if use typedefs
- From: <fago at caltech dot edu>
- To: gdb at sources dot redhat dot com
- Date: Thu, 9 Sep 2004 10:44:35 -0700 (PDT)
- Subject: Cannot subscript vector<vector<T> > in gdb if use typedefs
I am having a problem accessing the members of objects of the type
vector< vector< T > > if typedefs are used. See below for details.
I could not find anything related in the bug database. The problem may
be related to the thread:
http://sources.redhat.com/ml/gdb/2004-08/msg00265.html
except that reverting back to gcc 3.3.4 did not fix the issue.
Not sure if this is GCC or GDB, but thought I'd start here...
Thanks,
Matt
Test case and more details:
// gcc 3.4.2 (and 3.3.4), gdb 6.2.1, RHEL 3.0 ix86. Compile via:
//
// g++ -ggdb -o test main.cc
//
// In gdb, "p a[5][5]" results in:
//
// cannot subscript something of type \
// `std::vector<double,std::allocator<double> >'
//
// Removing DoubleVector and DoubleMatrix typedefs
// --> "p a1[5][5]" works
#include <vector>
#include <iostream>
typedef std::vector<double> DoubleVector;
typedef std::vector<DoubleVector > DoubleMatrix;
typedef std::vector< std::vector<double> > DM;
int main(int argc, char** argv) {
DoubleVector v(6);
DoubleMatrix a( 6, DoubleVector(6) );
DM a1( 6, std::vector<double>(6) );
std::cout << v[5] << a[5][5] << a1[5][5] << std::endl;
return 0;
}