This is the mail archive of the archer@sourceware.org mailing list for the Archer 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]

Issue with template_argument when template argument is an integer.



Hi,

I was attempting to write a pretty pritner for a class and found that I cant get the arguments to a template if they are NOT a type (eg if they are int).  

I was trying this with the 6.8.50 from 2009-08-3rd and got the following sort of output...
       gdb main
    b some-line
    run
    print MYYABA
    { var=10, woo=30 }
    py print gdb.history(0).type.template_argument(0)
    int
    py print gdb.history(0).type.template_argument(1)
    float
    py print gdb.history(0).type.template_argument(2)
    RuntimeError: No type named 12.

Am I approaching this from the wrong angle?


Cheers,
Luc

---------- CODE -------------
---------- CODE -------------
---------- CODE -------------

// SOME SORT OF CLASS
template <typename W, class Z, int F >
class YABA
{
public:
    W var ;
    Z woo ;

    YABA( )
    {
    }

    void set( W v )
    {
        var = v + F ;
        woo = woo / (F *1.0);
    }

    W get( void )
    {
        return( var+woo );
    }

};


// MAIN
void main( void )
{
    int result ;

    // print MYYABA
    // py print gdb.history(0).type.template_argument(0)
    // py print gdb.history(0).type.template_argument(1)
    //
    // error now, "RuntimeError: No type named 12."
    // py print gdb.history(0).type.template_argument(2)
    //
    YABA<int, float, 12 > MYYABA ;

    // Direct access...
    MYYABA.var = 10 ;
    MYYABA.woo = 30 ;

    MYYABA.set( 5 ) ; 
    result = MYYABA.get( ) ; 

    result = result ;
}


      


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