Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
std :: list.insertは、イテレータ位置の前に要素を挿入します。イテレータ位置の後に要素を挿入するにはどうすればよいですか。
それlist::insertがそうです。値を挿入する前にイテレータをインクリメントするだけです:
list::insert
if (someIterator != someList.end()) { someIterator++; } someList.insert(someIterator, someValue);
関数を使用します。
itr = mylist.insert_after(Itr, value)
valueの指す位置の後に を挿入しitrます。
value
itr