I have a class declared along the lines of
template<int a, int b>
class C {
public:
array[a][b];
}
and I want to use it as argument in a function like this:
bool DoSomeTests(C &c1, C &c2);
but when I compile, it tells me 'use of class template requires template argument list.' I tried
template<int a, int b>
bool DoSomeTests(C &c1, C &c2)开发者_Python百科;
but I get the same error. How can I fix this?
You need to provide arguments to the class template C
in the declaration of DoSomeTests
:
template<int a, int b>
bool DoSomeTests(C<a, b> &c1, C<a, b> &c2);
Both the class template C
and your function template DoSomeTests
take two int
template parameters but the fact that you want to map them from the function template to C
can't be inferred by the compiler.
精彩评论