codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
// listについての勉強 #include <iostream> #include <list> int main() { std::list<int> list; for (int i=0; i<10; i++) { list.push_back(i); } std::list<int>::iterator it = list.begin(); while (it != list.end()) { if (*it == 5) { it = list.erase(it); it = list.insert(it, 999); } it++; } it = list.begin(); while (it != list.end()) { std::cout << *it << std::endl; it++; } // = clear while (!list.empty()) { list.pop_back(); } std::cout << "list size: " << list.size() << std::endl; return 0; }
Private
[
?
]
Run code
Submit