hash_set:
ハッシュによる集合。要素の重複を許さない。
ハッシュで管理するために追加/削除/検索はかなり高速。
#include <cliext/hash_set>
using namespace System;
using namespace cliext;
int main() {
hash_set<String^> h(gcnew array<String^> { L"one", L"two", L"three", L"four" });
// 要素の重複を許さないので二個目のは挿入失敗
h.insert(L"five"); h.insert(L"five");
h.insert(L"six"); h.insert(L"six");
for each ( String^ item in h ) {
Console::Write(L"{0} ",item);
}
Console::WriteLine();
// "two"を見つけ、それ以降を出力
for ( hash_set<String^>::iterator iter = h.find(L"two");
iter != h.end(); ++iter ) {
Console::WriteLine(iter.get_ref());
}
return 0;
}