fail to pass a value in constructor
A class that uses &lt;...&gt; is called a template class.  That class uses a form of substitution at compile time to create a concrete class with those values and tokens substituted.

It is then that concrete class that is used to instantiate your object(s).

However, you are trying to use a runtime variable to convert a template class into a concrete class, and that can't be done at compile time - and there is no such thing as a runtime template in C++.

You need to re-think your implementation methodology.