Heap Corruption trying to add elements to existing std::vector
问题 I have an std::vector containing elements of class BoundingBox ( std::vector<BoundingBox> , which I call BB_Array ). First, i create this vector using a function that I will simplify here: BB_Array* Detector::generateCandidateRegions(BB_Array* candidates){ BB_Array* result = new BB_Array(); // without new here, i get segmentation fault BB_Array tempResult; // apply tests to candidates and add the good ones to tempResult ... // ... using tempResult.push_back((*candidates)[i]); for (int i=0; i