Created
August 10, 2020 16:11
-
-
Save c650/aef27b4930722cf75c1e9bcb565d5c30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
int main() { | |
std::vector<int> v{1,2,3,4}; | |
std::vector<int> b; | |
std::transform(v.begin(), v.end(), std::back_inserter(b), [](int a){return 2 * a;}); | |
for (const auto& e : b) { | |
std::cout << e << "\n"; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment