error: typedef name may not be a nested-name-specifier

Posted by Autopulated on Stack Overflow See other posts from Stack Overflow or by Autopulated
Published on 2010-06-13T07:36:15Z Indexed on 2010/06/13 7:42 UTC
Read the original article Hit count: 249

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about c++

Related posts about gcc