2011-12-07から1日間の記事一覧

C++の悩ましいイテレータ

C++

STLのstd::vector::iterator というのはtypedefであって、クラスではない。 なので、 std::vector<int> vec; std::vector<int>::iterator it; it = vec.begin(); it = it + 10; //← vec.end()を越える for(int i = 0; it != vec.end(); it++){ cout << "What's?" <</int></int>