开发者

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

开发者 https://www.devze.com 2023-01-03 19:27 出处:网络
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)

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


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

精彩评论

暂无评论...
验证码 换一张
取 消