hsh_multiset:
ハッシュによる集合。要素の重複を許す。
#include <cliext/hash_set>
#include <cliext/utility>
using namespace System;
using namespace cliext;
int main() {
hash_multiset<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"); h.insert(L"six");
for each ( String^ item in h ) {
Console::Write(L"{0} ",item);
}
Console::WriteLine();
// コンテナ内の"six"を列挙
typedef hash_multiset<String^>::iterator iterator;
for ( pair<iterator,iterator> range = h.equal_range(L"six");
range.first != range.second; ++range.first ) {
Console::WriteLine(range.first.get_ref());
}
return 0;
}