测试组件是否不存在。
bool empty();
备注
成员函数返回 true 为空控件序列。它与 hash_multiset::size (STL/CLR)() == 0等效。使用该测试 hash_multiset 是否为空。
示例
// cliext_hash_multiset_empty.cpp
// compile with: /clr
#include <cliext/hash_set>
typedef cliext::hash_multiset<wchar_t> Myhash_multiset;
int main()
{
Myhash_multiset 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/hash_set>
命名空间: cliext