got “cannot appear in a constant-expression” when using template
A non-type template argument needs to be a compile-time constant. Casting an int to a const int does not make it a compile-time constant. You either need to use 10 directly: or make i a const int: