开发者

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

开发者 https://www.devze.com 2022-12-28 09:47 出处:网络
Very similar to this post How can I declare template array as a parameter in templated function? Something like this code:

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


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

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

精彩评论

暂无评论...
验证码 换一张
取 消