次のように4x3のデータがあるとvector<vector<int> >
します。
1 2 3
4 5 6
7 8 9
10 11 12
要素を含むすべての行を削除8
して、次のようになります。
1 2 3
4 5 6
10 11 12
私はやろうとしてきました:
for (vector<vector<int> >::iterator it = v.begin(); it != v.end(); it++) {
if (find(it->begin(), it->end(), 8)) {
// I will remove the row in here
}
}
それは私に与えます:
error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int)'
私はあまり経験がないstl
ので、疑問に思っていました:
find
私の電話の何が問題になっていますか?- ベクトルを反復処理しながら、ベクトルから要素を削除しても安全ですか?
多くの場合、私の問題に対するエレガントな解決策も歓迎されます。