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'; }