Elzbieta Burnett <elzbieta.burn...@gmail.com> wrote in news:735599ee-
c452-4879-a11b-498299530...@f4g2000yqh.googlegroups.com:
I have:
struct point
{
double alpha, beta;
double Force;
point( double a, double b, double f ) : alpha(a), beta(b), Force(f)
{}
};
struct data
{
int dof;
int XYZ;
double X, Y, Z;
int node;
vector<point> pt;
};
map<int, data> AeroDOF;
I my initialization code I had:
AeroDOF[ dof[j] ].pt.push_back( point( alpha[i], beta[i],
Force[i][j] ) );
Your conclusion is right, but it does not follow from the above line. In
this line [] is used a lot, but the only case where the container type is
known it is a map (AeroDOF). All other variables where [] is applied to
are undefined/undeclared (dof, alpha, beta, Force) in your example and so
it is not clear if they are vectors, not to speak about how large they
are and if they are accessed out of bounds.
I thought that vector '[]' would create an instance of 'point' (like
map '[]'), call copy constructor and assign newly created entry to
point( alpha[i], beta[i], Force[i][j] ) in AeroDOF.pt.
On pt you are using push_back() which works more or less exactly as you
describe. Your problem is probably elsewhere.
Cheers
Paavo
this seems to work. Is there problem with this solution?