“used without template parameters”

后端 未结 5 2049
慢半拍i
慢半拍i 2021-02-01 03:34

I realize similar questions have been asked before, but I read a couple of those and still don\'t see where I\'m going wrong. When I simply write my class without separating th

5条回答
  •  星月不相逢
    2021-02-01 03:54

    You have to state the template parameter in the definition as well

    template
    int VisitedSet::getSize() {
        return vec.size();
    }
    

    otherwise the compiler cannot match it to the declaration. For example, there could be specializations for some parameter types.

提交回复
热议问题