Seached for this, but can\'t find a similar question. If there is one please close this question. This isn\'t my real code, just an example to demonstrate :-
Capture the size with an additional non-type parameter:
#include template class Test { public: ~Test() { std::cout << "Normal \n";} }; template class Test { public: ~Test() { std::cout << "Array " << N << '\n'; } }; int main() { Test i; // Array 3 Test j; // Array 5 }