fork(2) download
  1. #include <vector>
  2. #include <stdio.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. vector<int> stuff = {1,2,3,4,5};
  8. for(auto & n:stuff)
  9. {
  10. if ( n==3)
  11. {
  12. stuff.erase( stuff.begin() + (&n-stuff.data()) );
  13. break;
  14. }
  15. }
  16. for(auto &n:stuff)
  17. {
  18. printf("%d",n);
  19. }
  20.  
  21. }
Success #stdin #stdout 0s 4556KB
stdin
Standard input is empty
stdout
1245