How to print the return value of template member functions (C++)?

Peng Yu pengyu.ut@gmail.com
Thu Jan 4 01:04:00 GMT 2007


Hi,

I have the following C++ program. I try to print a.get<0>(). But I
failed. Do you know how to do it?


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;
}


(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>



More information about the Gdb mailing list