mardi 27 août 2019

compile error when a template function call a template static function in a template class

A compile error when I write template in c++, hard to understand for me. This is the code

template<typename T>
struct S
{
    template<typename U>
    static void fun()
    {
    }
};

template<typename T>
void f()
{
    S<T>::fun<int>(); //compile error, excepted primary expression before `int`

}

Aucun commentaire:

Enregistrer un commentaire