If this is a duplicate, I apologize. I looked around and found similar problems, but nothing of the kind.
If I create a template this way ...
MyClass<int[10]> c;
How can I write a template to access the type and size of an array? I tried everything I could, and I canβt get it.
I was inspired by the std :: function template, which allows you to use the same syntax for a function prototype, for example ...
std::function<int(MyClass&)> myfunc;
So, I thought it would be nice to have something similar for the array and its size. I can use any of the latest C ++ features (C ++ 11/14).
c ++ c ++ 11 templates template-meta-programming
extracrispy
source share