Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
remove_copy_if-30-Seconds-of-C++
#include <iostream> #include <vector> #include <algorithm> int main() { auto isOdd = [](int i) { return ((i%2) == 1); }; std::vector<int> origin {1, 2, 3, 4, 5}; std::vector<int> destination; // Copy elements to destination that return false for isOdd std::remove_copy_if(origin.begin(), //first origin.end(), //last std::back_inserter(destination), //d_first isOdd); // origin is still {1, 2, 3, 4, 5} for (auto value : origin) { std::cout << value << " "; } std::cout << std::endl; // destination is {2, 4} for (auto value : destination) { std::cout << value << " "; } std::cout << std::endl; }
run
|
edit
|
history
|
help
0
sort
OperatorOverload2
stack::emplace for 30-second c++
Conjuntos - Comparar cantidad de elementos únicos en 2 vectores
pointer array of functions
shell sort
memcpy
Equilateral triangle
HotelVec
Dead_Lock