This will go faster if I show you what I want to do.
class matrix {
public:
double *x;
int clms, rows;
matrix(int unknowns)
{
rows = unknowns;
clms = unknowns + 1;
x = new double[rows * clms];
}
matrix operator = (double a[]) const
{
matrix tmp(rows);
tmp.x = a;
return tmp;
}
};
int main()
{
matrix m(3) = { 1, 2, 3.2, 4,
3, .2, 1, 4,
5, -2, .68, 5};
}
basically I want to be able to initialize and fill up m.x with the array that I passed it.
This is basically what the string class lets you do, for example:
string s = { 'h', 'e', 'l', 'l', 'o' , '\0' };
or as normal people do:
string s = "hello";
Anyone know how to do this?