recently I knew a new template usage like below
template <unsigned int N>
I saw the answer here
What does template <unsigned int N> mean?
It showed several examples includes:
template<unsigned int S>
struct Vector {
unsigned char bytes[S];
};
However, I cannot figure out the point of this usage. Why don't we just use class initialization to do this work. What's the point of using a template here?
`. Calling this `Vector` might suggest a similarity to `std::vector`. And that's precisely the relevant difference: compile-time versus run-time sizing.