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?

Take a look at http://www.deitel.com/articles/cplusplus_tutorials/20060204/index.html

SUMMARY:
This tutorial introduces a copy constructor for initializing a new Array object with the contents of an existing Array object. This tutorial is intended for students and professionals who are familiar with basic array, pointer and class concepts in C++.

Yes but I'm not going to pass another matrix class object to the = operator, instead I want to initialize the member x array as I would a regular array, like this:
matrix m(3) = { 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 ,12};

and not do this:

matrix m(3), m2(3);
for (int i = 0; i < 12; i++)
m.x = i + 1;
m2 = m;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.