If I have a vector of SomeClass objects and those objects are created inside another method using "new", will the vector properly handle memory management when destroyed? Or do i have to keep track of them and delete them myself?
Code://I have no control over the type of this, //so I have to populate a vector<SomeClass> //instead of vector<SomeClass*> SomeClass getData() { return * ( new SomeClass() ); } int main() { std::vector<SomeClass> r = getDataHolder(); r.push_back( getData() ); }