queue::empty (STL/CLR)
測試是否沒有項目呈現。
bool empty();
備註
成員函式會傳回空白的受控制序列的則為 true。 它相當於queue::size (STL/CLR)() == 0。 您可以用它來測試是否佇列是空的。
範例
// cliext_queue_empty.cpp
// compile with: /clr
#include <cliext/queue>
typedef cliext::queue<wchar_t> Myqueue;
int main()
{
Myqueue c1;
c1.push(L'a');
c1.push(L'b');
c1.push(L'c');
// display initial contents " a b c"
for each (wchar_t elem in c1.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
System::Console::WriteLine("size() = {0}", c1.size());
System::Console::WriteLine("empty() = {0}", c1.empty());
// clear the container and reinspect
c1.pop();
c1.pop();
c1.pop();
System::Console::WriteLine("size() = {0}", c1.size());
System::Console::WriteLine("empty() = {0}", c1.empty());
return (0);
}
需求
標頭: < cliext/佇列 >
Namespace: cliext