Skip to content

Instantly share code, notes, and snippets.

@GoBigorGoHome
Last active November 8, 2019 16:03
Show Gist options
  • Save GoBigorGoHome/e0176929b400376fcd33743098c200c8 to your computer and use it in GitHub Desktop.
Save GoBigorGoHome/e0176929b400376fcd33743098c200c8 to your computer and use it in GitHub Desktop.
C++ 黑科技
#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, ", "));
}
@GoBigorGoHome
Copy link
Author

从 cppreference 上看到的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment