list-empty

////////////////////////////////////////
//      2018/04/25 21:22:00
//      list-empty

// true if the list is empty
#include <iostream>
#include <list>

using namespace std;

int main(){
    list<int> l;

    cout << "List is";
    l.empty() ? cout << " " : cout << "not";
    cout << "empty." << endl;

    l.push_back(100);

    cout << "List is";
    l.empty() ? cout << " " : cout << "not";
    cout << "empty." << endl;
    return 0;
}


/*
OUTPUT:
    List is empty.
    List isnotempty.
*/ 
原文地址:https://www.cnblogs.com/laohaozi/p/12537968.html