multiset::empty (STL/CLR)
測試是否沒有項目呈現。
bool empty();
備註
成員函式會傳回空白的受控制序列的則為 true。它相當於multiset::size (STL/CLR)() == 0。您可以用它來測試是否是空的多重集。
範例
// cliext_multiset_empty.cpp
// compile with: /clr
#include <cliext/set>
typedef cliext::multiset<wchar_t> Mymultiset;
int main()
{
Mymultiset c1;
c1.insert(L'a');
c1.insert(L'b');
c1.insert(L'c');
// display initial contents " a b c"
for each (wchar_t elem in c1)
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.clear();
System::Console::WriteLine("size() = {0}", c1.size());
System::Console::WriteLine("empty() = {0}", c1.empty());
return (0);
}
需求
標頭: < cliext/設定 >
Namespace: cliext