| 4 | #include <iterator> |
| 5 | #include <algorithm> |
| 6 | int main() |
| 7 | { |
| 8 | std::vector<int> v{1,2,3,4,5}; |
| 9 | std::deque<int> d; |
| 10 | std::copy(v.begin(), v.end(), |
| 11 | std::front_insert_iterator<std::deque<int>>(d)); // or std::front_inserter(d) |
| 12 | for(int n : d) |
| 13 | std::cout << n << ' '; |
| 14 | std::cout << '\n'; |
| 15 | } |