Last active
November 8, 2019 16:03
-
-
Save GoBigorGoHome/e0176929b400376fcd33743098c200c8 to your computer and use it in GitHub Desktop.
C++ 黑科技
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 <iterator> | |
#include <vector> | |
#include <algorithm> | |
int main() { | |
std::vector<int> v{ 1, 3, 10, 8, 22 }; | |
std::sort(v.begin(), v.end()); | |
std::copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, ", ")); | |
std::cout << '\n'; | |
std::copy( | |
std::make_reverse_iterator(v.end()), | |
std::make_reverse_iterator(v.begin()), | |
std::ostream_iterator<int>(std::cout, ", ")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
从 cppreference 上看到的。