fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. typedef vector<vector<int>> VecInt2D;
  6.  
  7. void erase_a_row(VecInt2D& v, size_t where)
  8. {
  9. if ( !(where >= 0 && where < v.size()))
  10. return;
  11. v.erase(v.begin() + where);
  12. }
  13.  
  14. int main() {
  15. VecInt2D myVect(10);
  16. cout << myVect.size() << "\n";
  17. // erase the last item
  18. erase_a_row(myVect, myVect.size() - 1);
  19. cout << myVect.size() << "\n";
  20. return 0;
  21. }
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
10
9