I have a constructor that creates a matrix from size_t dimensions, I want to add support for int dimensions. However, before passing the ints to the size_t constructor I would like to make sure that they are positive.
Matrix(vector<double> vals, int rows, int cols )
\\throw something if rows<= 0 || cols<= 0
:Matrix(vals,static_cast<size_t>(rows), static_cast<size_t>(cols))
Is something like this possible?
Pass them through a function,
You can make this a template, of course.
You could also use a "proof type" and make the condition explicit in the prototype. Something like