Vector * divide (vector K, float line) { Vector * p=new vector [2]. For (vector : : iterator it=k.b do v.begin (); It & lt;=Kevin Everett sat nd () - 1; It++) { If ((* it). X & lt;=line) { P [0]. Push_back (* it); Kevin Everett sat rase (it); } The else { P [1]. The push_back (* it); Kevin Everett sat rase (it); } } Return the p; }
This function has been run, tip "Caused abnormal: read access rights conflict, _Mycont is nullptr, " But remove the Kevin Everett sat rase () is no problem, is can't use? Konjac thank leaders answer
CodePudding user response:
After it is deleted, it is there something in the iterator? Sure I don't think so, you for loop still use it++, is bound to go wrong, or use the erase places it++, and remove the for loop on the operation