#include <bits/stdc++.h>

using namespace std;

template <typename T>
void print(deque<T> &dq)
{
    typename deque<T>::iterator it = dq.begin();
    while (it != dq.end())
    {
        cout << *it << " ";
        it++;
    }
    cout << endl;
}

int main()
{
    int m[] = {1, 2, 3, 4, 5, 6};
    deque<int> d1;
    deque<int> d2(m, m + 6);

    deque<int> d4 = d2; // 拷贝构造函数: deque(const deque &deq)
    print(d4);

    d1 = d2; // 赋值运算符: deque& operator=(const deque &deq)
    print(d1);

    print(d2);

    deque<int> d3(10, 1); // 10 个 1
    print(d3);

    cout << "d5.swap(d2):" << endl;
    deque<int> d5;
    d5.swap(d2);
    print(d5);
    print(d2);

    return 0;
}
