Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
remove_if_30-Seconds-of-C++
#include <iostream> #include <vector> #include <algorithm> int main() { auto isOdd = [](int i) { return ((i%2) == 1); }; std::vector<int> v {1, 2, 3, 4, 5}; // Remove all elements that returns true for isOdd auto newEndIt = std::remove_if(v.begin(), v.end(), isOdd); // Erase elements from [newEndIt, v.end()] v.erase(newEndIt, v.end()); // v is now {2, 4} for (auto value : v) { std::cout << value << " "; } }
run
|
edit
|
history
|
help
0
GRAPH DFS & BFS
Gauss 4x4 reducido
Void main
Segment Tree
Insertion Sort
Procesos E
TempSpecial2
Meeting_Leandro
HeapSort
My love