list-clear

////////////////////////////////////////
//      2018/04/25 21:19:18
//      list-clear

// removes all elements
#include <iostream>
#include <list>

using namespace std;

int main(){
    list<int> l(5, 10);
    cout << "size of list = " << l.size() << endl;
    l.clear();
    cout << "After l.clear() size of list = " << l.size() << endl;
    return 0;
}


/*
OUTPUT:
    size of list = 5
    After l.clear() size of list = 0
*/
posted @ 2018-04-25 22:03  老耗子  阅读(63)  评论(0编辑  收藏  举报