This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to print the return value of a template member function


Hi,

I have the following program listed below this email. I want to
inspect 'a.get<0>()' from gdb. But I got the following error message.
Can you show me what the right way should be?

(gdb) start
Breakpoint 1 at 0x80489a4: file main.cc, line 5.
[Thread debugging using libthread_db enabled]
[New Thread -1217684800 (LWP 6424)]
[Switching to Thread -1217684800 (LWP 6424)]
main () at main.cc:5
5         boost::tuple<int, int> a(10, 10);
(gdb) n
6         std::cout << a.get<0>() << " " << a.get<1>() << std::endl;
(gdb) p a.get<0>()
Couldn't find method
boost::tuples::tuple<int,int,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>::get<0>
(gdb)

Thanks,
Peng

$ cat main.cc
#include <boost/tuple/tuple.hpp>
#include <iostream>

int main() {
 boost::tuple<int, int> a(10, 10);
 std::cout << a.get<0>() << " " << a.get<1>() << std::endl;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]