#include <iostream>

#include <vector>


using namespace std;


class test

{

public:

    test() { cout << "constructor" << endl; }

    ~test() { cout << "destructor" << endl; }

};


int main()

{

    vector<test> testList;

    for(int i = 0; i < 10; ++i)

    {

        testList.push_back(test());

        cout << "capacity : " << testList.capacity() << endl;

    }

    cout << endl << endl;

    for(vector<test>::iterator iter = testList.begin(); iter != testList.end();)

    {

        iter = testList.erase(iter);

        cout << "capacity : " << testList.capacity() << endl;

    }

    std::vector<test>().swap(testList); // testList.shrink_to_fit();

    cout << "final capacity : " << testList.capacity() << endl;

    return 0;

}



사실은 나도 swap 잘되나 따라해 봄. 담엔 이미지로 바르지 말고 좀 텍스트로 올려라.