I can do this:
struct foo{
foo(std::array<double, 3>){}
foo(std::array<double, 4>){}
}
I would like to do this:
struct foo{
foo(double A[3]){}
foo(double A[4]){}
}
Which, of course, does not work.
This involves legacy code with a lot of 3 and 4 element double arrays. I desire to construct a class that contains 4 doubles from either 3 or 4 element arrays, and initialize the 4th double with a constant value when constructing from a 3 element array. When I initialize from a 4 element array, I just copy in the 4 elements.
So, I would like to make constructor(s) to recognize:
double something[3];
from:
double something_else[4];
The best I can think of is to add another parameter to the constructor to distinguish between the two.
class foo{
foo(double A[4], bool only_3 = false){}
foo(double *A, size_t n = 4){}
}
Any better ideas?
(As time permits, I'll chase out all the raw arrays, but for now I have to deal with it.)