hash_set::hash_set (STL/CLR)
Konstrukce objektu kontejneru.
hash_set();
explicit hash_set(key_compare^ pred);
hash_set(key_compare^ pred, hasher^ hashfn);
hash_set(hash_set<Key>% right);
hash_set(hash_set<Key>^ right);
template<typename InIter>
hash_sethash_set(InIter first, InIter last);
template<typename InIter>
hash_set(InIter first, InIter last,
key_compare^ pred);
template<typename InIter>
hash_set(InIter first, InIter last,
key_compare^ pred, hasher^ hashfn);
hash_set(System::Collections::Generic::IEnumerable<GValue>^ right);
hash_set(System::Collections::Generic::IEnumerable<GValue>^ right,
key_compare^ pred);
hash_set(System::Collections::Generic::IEnumerable<GValue>^ right,
key_compare^ pred, hasher^ hashfn);
Parametry
první
Začátek oblasti vložení.hashfn
Hash funkce pro mapování kláves bloků.poslední
Konec rozsahu vložit.před
Predikát pro řízené pořadí řazení.pravý
Objekt nebo oblast pro vložení.
Poznámky
Konstruktor:
hash_set();
Inicializuje řízené posloupnosti s žádné prvky s výchozí řazení predikát key_compare()a s výchozí funkce hash.Použít prázdný počáteční řízené sekvenci, určit s výchozí řazení predikátu a hash funkce.
Konstruktor:
explicit hash_set(key_compare^ pred);
Inicializuje řízené posloupnosti s žádné prvky s objednávání predikát preda s výchozí funkce hash.Použít prázdný počáteční řízené posloupnosti, určit zadané predikát objednávání a výchozí funkce hash.
Konstruktor:
hash_set(key_compare^ pred, hasher^ hashfn);
Inicializuje řízené posloupnosti s žádné prvky s objednávání predikát preda s transformační funkcí hashfn.Použít prázdný počáteční řízené posloupnosti, určit s určenou funkci řazení predikátu a algoritmu hash.
Konstruktor:
hash_set(hash_set<Key>% right);
Inicializuje řízené posloupnosti s sekvence [right.hash_set::begin (STL/CLR)(), right.hash_set::end (STL/CLR)()), s výchozí predikát řazení a výchozí funkce hash.Použít k zadání počáteční řízené sekvence, která je kopií sekvence řízena objektu hash_set right, s výchozí řazení predikátu a funkci hash.
Konstruktor:
hash_set(hash_set<Key>^ right);
Inicializuje řízené posloupnosti s sekvence [right->hash_set::begin (STL/CLR)(), right->hash_set::end (STL/CLR)()), s výchozí predikát řazení a výchozí funkce hash.Použít k zadání počáteční řízené sekvence, která je kopií sekvence řízena objektu hash_set right, s výchozí řazení predikátu a funkci hash.
Konstruktor:
template<typename InIter>
hash_set(InIter first, InIter last);
Inicializuje řízené posloupnosti s sekvence [first, last), s výchozí predikát řazení a výchozí funkce hash.Pomocí vytvoření kopie jiného pořadí řízené sekvence s výchozí predikát a zatřiďovací funkci řazení.
Konstruktor:
template<typename InIter>
hash_set(InIter first, InIter last,
key_compare^ pred);
Inicializuje řízené posloupnosti s sekvence [first, last), objednávání predikát s preda s výchozí funkce hash.Pomocí řízené sekvence vytvoření kopie jiného pořadí určené predikát objednávání a výchozí funkce hash.
Konstruktor:
template<typename InIter>
hash_set(InIter first, InIter last,
key_compare^ pred, hasher^ hashfn);
Inicializuje řízené posloupnosti s sekvence [first, last), objednávání predikát s preda s transformační funkcí hashfn.Pomocí vytvoření kopie jiného pořadí určené objednávání predikátu a hash funkce řízené sekvence.
Konstruktor:
hash_set(System::Collections::Generic::IEnumerable<Key>^ right);
Inicializuje řízené sekvence s posloupností určené čítače výčtu right, s výchozí predikát řazení a výchozí funkce hash.Pomocí vytvoření kopie jiného pořadí popsaná enumerátor s výchozí řazení predikátu a hash funkce řízené sekvence.
Konstruktor:
hash_set(System::Collections::Generic::IEnumerable<Key>^ right,
key_compare^ pred);
Inicializuje řízené sekvence s posloupností určené čítače výčtu right, objednávání predikát s preda s výchozí funkce hash.Pomocí vytvoření kopie jiného pořadí popsaný čítač výčtu zadané objednávání predikátu a výchozí hodnoty hash funkce řízené sekvence.
Konstruktor:
hash_set(System::Collections::Generic::IEnumerable<Key>^ right,
key_compare^ pred, hasher^ hashfn);
Inicializuje řízené sekvence s posloupností určené čítače výčtu right, objednávání predikát s preda s transformační funkcí hashfn.Pomocí vytvoření kopie jiného pořadí popsaný čítač výčtu zadané objednávání predikátu a hash funkce řízené sekvence.
Příklad
// cliext_hash_set_construct.cpp
// compile with: /clr
#include <cliext/hash_set>
int myfun(wchar_t key)
{ // hash a key
return (key ^ 0xdeadbeef);
}
typedef cliext::hash_set<wchar_t> Myhash_set;
int main()
{
// construct an empty container
Myhash_set c1;
System::Console::WriteLine("size() = {0}", c1.size());
c1.insert(L'a');
c1.insert(L'b');
c1.insert(L'c');
for each (wchar_t elem in c1)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an ordering rule
Myhash_set c2 = cliext::greater_equal<wchar_t>();
System::Console::WriteLine("size() = {0}", c2.size());
c2.insert(c1.begin(), c1.end());
for each (wchar_t elem in c2)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an ordering rule and hash function
Myhash_set c2h(cliext::greater_equal<wchar_t>(),
gcnew Myhash_set::hasher(&myfun));
System::Console::WriteLine("size() = {0}", c2h.size());
c2h.insert(c1.begin(), c1.end());
for each (wchar_t elem in c2h)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
System::Console::WriteLine();
// construct with an iterator range
Myhash_set c3(c1.begin(), c1.end());
for each (wchar_t elem in c3)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an iterator range and an ordering rule
Myhash_set c4(c1.begin(), c1.end(),
cliext::greater_equal<wchar_t>());
for each (wchar_t elem in c4)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an iterator range and an ordering rule and hash function
Myhash_set c4h(c1.begin(), c1.end(),
cliext::greater_equal<wchar_t>(),
gcnew Myhash_set::hasher(&myfun));
for each (wchar_t elem in c4h)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
System::Console::WriteLine();
// construct with an enumeration
Myhash_set c5( // NOTE: cast is not needed
(System::Collections::Generic::IEnumerable<wchar_t>^)%c3);
for each (wchar_t elem in c5)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an enumeration and an ordering rule
Myhash_set c6( // NOTE: cast is not needed
(System::Collections::Generic::IEnumerable<wchar_t>^)%c3,
cliext::greater_equal<wchar_t>());
for each (wchar_t elem in c6)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an enumeration and an ordering rule and hash function
Myhash_set c6h( // NOTE: cast is not needed
(System::Collections::Generic::IEnumerable<wchar_t>^)%c3,
cliext::greater_equal<wchar_t>(),
gcnew Myhash_set::hasher(&myfun));
for each (wchar_t elem in c6h)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
System::Console::WriteLine();
// construct from a generic container
Myhash_set c7(c4);
for each (wchar_t elem in c7)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct by copying another container
Myhash_set c8(%c3);
for each (wchar_t elem in c8)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
return (0);
}
Požadavky
Záhlaví: < cliext/hash_set >
Obor názvů: cliext