views:

94

answers:

1

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);

but I get the same error. How can I fix this?

+6  A: 

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.

Charles Bailey
Thanks, now that I look at it it seems pretty obvious ^^.
Keand64
And the reason it can't be inferred is that you could well be meaning:`bool DoSomeTests(C<a,b>)
Matthieu M.