[Solved] How to erase elements in STL vector without copying iterator and without memory leakage?
You dont need to worry about memory leaks, in your case you use std::vector which uses RAII to make sure no memory is leaked. With STL containers you can “leak” in such case on;y if you do not shrink your vector after using remove algorithm. Below is fix to your code, and not entire rewrite. … Read more