Created
February 8, 2022 00:10
-
-
Save Aposhian/4351f4824aafcce6bb9d645cc0952704 to your computer and use it in GitHub Desktop.
test of std::transform behavior when start and end are the same
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 <algorithm> | |
#include <vector> | |
#include <iostream> | |
int main() { | |
std::vector<int> a = { 0, 1, 2, 3 }; | |
std::vector<int> b; | |
std::transform( | |
a.begin(), a.begin(), | |
std::back_inserter(b), | |
[](const auto& x) { | |
return x; | |
} | |
); | |
std::cout << "a.size() = " << a.size() << std::endl | |
<< "b.size() = " << b.size() << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment