ok, now that you explain the application, the it does not look like a stress test anymore.
so
typedef double p_3d[3];
is fixed.
And you dont want duplications so
you want AllPoints to keep all-the-points
while the triangles are formed using pointers to these points. Am i right ?
how about this:
struct Traingle{ double *vert[3]; };
main(){
vector<p_3d*> AllPoints;
p_3d point; point[0] = 3; .....
p_3d* ptr2pt = &point;
allPoints.push_back( ptr2pt) ;
struct Traingle t;
t.vert[0] = point;
t.vert[0][0] = 6;
}
the problem with the initial solution now i tihnk , was that the moment you define an array
double p_3d[3];
p_3d is a const pointer to double.
in the above solution, my intnetion was to store pointer to the point, bcos then the default copy constructor (called when parameters are passed or if allPoints = ... is used) works fine with a pointer, but not when an the intention is to copy an entire array.
The vector works on the assumption that it keeps a copy of the data that it later gives bk, unlike our C array, where a means a fixed location which can be tampered with and whose address can be taken