#include <vector> #include <iostream> #include <iterator> #include <algorithm> using namespace std; int main() { vector<int> v{1,2,3}; reverse(begin(v), end(v));//反转容器元素顺序 for(auto e : v) cout << e; cout << ‘\n‘; int a[] = {4, 5, 6, 7}; reverse(begin(a), end(a));//反转容器元素顺序 for(auto e : a) cout << e; }
原文:https://www.cnblogs.com/sea-stream/p/10111736.html