TreeOfLife
TreeOfLife

Reputation: 123

Wrong number of template arguments error

I'm new to templates and trying to use my functions that are out of the class to adapt to the generic programming. But wenn I do this:

template<int C, int D>
class A{
    ...
}

float function(number<int C, int D> value);

it leads to following error:

Error: wrong number of template arguments (1, should be 2)
float function(number<int C, int D> value);
                               ^

Am I missing something here?

Upvotes: 1

Views: 3506

Answers (1)

filmor
filmor

Reputation: 32298

You need to define template arguments on the function and forward them to the type:

template<int C, int D>
float function(number<C, D> value);

Upvotes: 2

Related Questions