fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. vector <int> arr = { 2, 4, 3 };
  6. forward_list <int> listOne;
  7. copy(arr.rbegin(), arr.rend(), front_inserter(listOne));
  8.  
  9. for (auto & item : listOne)
  10. cout << item << endl;
  11. return 0;
  12. }
Success #stdin #stdout 0.01s 5344KB
stdin
Standard input is empty
stdout
2
4
3