empty
语法:
1 |
bool empty(); |
empty()函数返回真(true)如果链表为空,否则返回假。
1 2 3 4 5 6 7 8 9 |
源代码 /** * Returns true if the %list is empty. (Thus begin() would equal * end().) */ bool empty() const { return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; } |
测试代码
测试结果
charList内无元素