tags:

views:

205

answers:

1

I am trying to do something along the lines of this answer, and struggling:

$ gcc --version
gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4)

file.cpp:7: error: template argument 1 is invalid  
file.cpp:7: error: typedef name may not be a nested-name-specifier

And the offending part of the file:

template <class R, class C, class T0=void, class T1=void, class T2=void>
struct MemberWrap;

template <class R, class C, class T0>
struct MemberWrap<R, C, T0>{
    typedef R (C::*member_t)(T0);
    typedef typename boost::add_reference<typename T0>::type> TC0; // <---- offending line

    MemberWrap(member_t f)
        : m_wrapped(f){
    }

    R operator()(C* p, TC0 p0){
        GILRelease guard;
        return (p->*(this->m_wrapped))(p0);
    }

    member_t m_wrapped;
};
+2  A: 

Drop typename from typename T0 in

typedef typename boost::add_reference<typename T0>::type> TC0;

and probably drop the second angle bracket as well. I.e.

typedef typename boost::add_reference<T0>::type TC0;
avakar
Thanks, can't believe I missed that!
Autopulated