Error calling template method in “templated-base-class”

前端 未结 1 1029
北荒
北荒 2021-01-14 09:12

The following code does not compile, why is that? And how can I fix this?

struct A{
    template int get() { return N; }
};

template 

        
相关标签:
1条回答
  • 2021-01-14 09:58

    you must disambiguate it, like so:

    template<int N>int get() {
        return X::template get<N>();
    }
    
    0 讨论(0)
提交回复
热议问题