priority_queue::empty (STL/CLR)
測試是否沒有項目呈現。
bool empty();
備註
成員函式會傳回空白的受控制序列的則為 true。 它相當於priority_queue::size (STL/CLR)() == 0。 您可以用它來測試是否是空的 priority_queue。
範例
// cliext_priority_queue_empty.cpp
// compile with: /clr
#include <cliext/queue>
typedef cliext::priority_queue<wchar_t> Mypriority_queue;
int main()
{
Mypriority_queue 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