C++: Vector of Pointers to Objects from another Vector -
i have 2 classes, similar this: class { public: b* ptr1; } class b { public: std::vector<a*> list; } in main implementation, i'm doing this: int main() { // there lot more objects b objects, i.e. listofa.size() >>> listofb.size() std::vector<a> listofa; std::vector<b> listofb; while (//some loop) { listofb[jj].list.push_back( &(listofa[ii]) ); listofa[ii].ptr1 = &( listofb[jj] ); } } // int main end basically this. lot of objects assigned 1 b object, , these objects stored in pointer vector pointers. additionally, each of these objects pointer b object belong to. context, i'm doing connected components algorithm run-length-encoding (for image segmentation), class line segments , class b final objects in image. so, pointers of vector in class b point objects stored in regular vector. these objects should deleted when regular vector goes out of scope, right? i've read vector of pointer in class b requires w...