vectorの二次元配列

便利なのか微妙なところだ…。

#include <iostream>
#include <vector>

using namespace std;

void f(vector< vector<int> >& vv_) {
  vector< vector<int> > vv = vv_;

  for (vector< vector<int> >::const_iterator  i = vv.begin(); i != vv.end(); i++) {
    vector<int> v = *i;

    for (vector<int>::const_iterator j = v.begin(); j != v.end(); j++) {
      cout << *j << endl;
    }
  }

}

int main() {
  vector< vector<int> > vv;

  vector<int> v1;
  v1.push_back(1);
  v1.push_back(2);
  v1.push_back(3);

  vector<int> v2;
  v2.push_back(11);
  v2.push_back(22);
  v2.push_back(33);

  vv.push_back(v1);
  vv.push_back(v2);

  f(vv);

  return 0;
}