I am having issues populating a vector using "new" where nodeVec is a vector where each entry consists of another vector with 3 elements. zMap is the vector I am trying to populate with the sum of the squares of the first two elements for each entry in nodeVec.
Now hold on a minute. Don't return zMap by value when it is already passes as a reference parameter. That is a waste of time.
The new statement makes no sense at all. What do you want a double or a vector<double>? YOu have allocated a pointer to a single double and I have no idea what that new statement means. What's a Vec type by the way?
The push_back is incorrect. zMap is a vector<double> not a vector<double*>. Even if the new worked you have a memory leak as you are trying to dynamically allocate without using delete. I'm not sure that you need to dynamically allocate using new at all based on your problem description. I recommend that you try again without using operator new. Finally remember that a*a is equal to a2. Good luck!