vendredi 24 février 2017

C++ error in template function call: type name is not allowed

Diab compiler complains in line @@@ that type name is not allowed.

template<
    Task TASK,
    Event EVENT>
class TManager :
    public AbstractTManager,
    public common::ITManager
{
    public:
    typedef os::EManager<TASK>  tEManager;

    TManager()
    { /* ... */}

    virtual void init()
    {

        tEManager::registerCallback<
            EVENT,
            TManager, /* @@@ */
            &TManager::func>(*this);
    }

    void func()
    { /* ... */}
}

In EManager registerCallback is defined in following way:

template<TType task>
class EManager
{
public:
    template<
        EType event,
        typename e_listener,
        void (e_listener::*TMethod)()
        >
    static void registerCallback(e_listener& listener)
    {
        /* ... */
    }
}

The second template argument is e_listener with keyword typename so I don't know why it reports problem. Did I miss something? Thank you for help in advance.

Aucun commentaire:

Enregistrer un commentaire