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

Peng Yu pengyu.ut@gmail.com
Thu Jan 4 22:06:00 GMT 2007


On 1/4/07, Daniel Jacobowitz <drow@false.org> wrote:
> On Thu, Jan 04, 2007 at 02:36:55PM +0100, Andreas Schwab wrote:
> > "Peng Yu" <pengyu.ut@gmail.com> writes:
> >
> > > $ 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>
> >
> > I can't reproduce that with gdb 6.6.
>
> I can't with either 6.5 or 6.6.  It must be some other environmental
> difference.
>
> I'm somewhat impressed that it works - GDB doesn't handle templates
> well.

I tried on 6.6 as well. The same error is gotten. Would you please let
me know what kind of environmental stuffs are relevant so that I
narrow down the problem?

Thanks,
Peng



More information about the Gdb mailing list