I am trying to use an integer as a template parameter for a class. Here is a sample of the code:
template< int array_qty >
class sample_class {
p
Template arguments must be compile-time constants aka "constant expressions" or constexpr
s for short. So there is no way to do is using templates.
You could use a dynamic-sized array and store its size in an int
.
Or simply use a vector
. Be sure to initialize its size in the constructor by passing the desired size to the vector's constructor!