dasblinkenlight has already given quite a good answer, however, there is a second way to do it that's more efficient. Because, if you do (the code is taken from his answer)
matrix[i] = new obj[n];
for (int j = 0 ; j != n ; j++) {
matrix[i][j] = obj(arg1, arg2, arg3); // Non-default constructor
}
the following will happen:
Memory for n
objects is allocated.
All n
objects are default constructed.
For each object, a new object is custom constructed on the stack.
This object on the stack is copied into the allocated object.
The object on the stack is destructed.
Obviously much more than would have been necessary (albeit perfectly correct).
You can work around this by using placement new syntax:
matrix[i] = (obj*)new char[n*sizeof obj]; //Allocate only memory, do not construct!
for (int j = 0 ; j != n ; j++) {
new (&matrix[i][j]) obj(arg1, arg2, arg3); // Non-default constructor called directly on the object in the matrix.
}