Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
remove_copy-30-Seconds-of-C++
#include <iostream> #include <vector> #include <algorithm> int main() { std::vector<int> origin {3, 5, 3, 1, 2, 3}; std::vector<int> destination; // Copy elements to destination that are not 3 std::remove_copy(origin.begin(), //first origin.end(), //last std::back_inserter(destination), //d_first 3); // origin is still {3, 5, 3, 1, 2, 3} for (auto value : origin) { std::cout << value << " "; } std::cout << std::endl; // destination is {5, 1, 2} for (auto value : destination) { std::cout << value << " "; } std::cout << std::endl; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Virtuals
replace_copy_if-30-Seconds-of-C++
Weighted Average
q
Search in a rotated sorted array two methods
ThreadPool
Size of data type test
Badanie symetryczności macierzy
12532
Print All Paths In Matrix
Please log in to post a comment.