c++ 判断list是否为空(empty)

 

#include <list>
#include <iostream>
using namespace std;
int main()
{
    list<int> numbers;
    cout << "Initially, numbers.empty(): " << numbers.empty() << '\n';
    
    numbers.push_back(42);
    numbers.push_back(13317);
    cout << "After adding elements, numbers.empty(): " << numbers.empty() << '\n';
}

 

posted @ 2018-12-12 20:27  anobscureretreat  阅读(2709)  评论(0编辑  收藏  举报