user283145
user283145

Reputation:

C++: how to declare template array as function parameter

Very similar to this post

How can I declare template array as a parameter in templated function?

Something like this code:

template <unsigned i> void my_func (char (&a)[i]); //yes, I do need that reference

Upvotes: 1

Views: 838

Answers (1)

Billy ONeal
Billy ONeal

Reputation: 106609

Just declare an extra template parameter, which contains the type in question.

template <typename T, unsigned i>
void my_func (T (&a)[i]);

Upvotes: 5

Related Questions