Aracılığıyla paylaş


hash_multiset::hash_multiset

[!NOT]

Bu API artık kullanılmıyor.Alternatif unordered_multiset Class.

Oluşturan bir hash_multiset yani boş veya yani bir kopyasını tüm veya bazı diğer parçası hash_multiset.

hash_multiset( );
explicit hash_multiset(
   const Traits& _Comp
);
hash_multiset(
   const Traits& _Comp,
   const Allocator& _Al
);
hash_multiset(
   const hash_multiset<Key, Traits, Allocator>& _Right
);
template<class InputIterator>
   hash_multiset(
      InputIterator _First,
      InputIterator _Last
   );
template<class InputIterator>
   hash_multiset(
      InputIterator _First,
      InputIterator _Last,
      const Traits& _Comp
   );
template<class InputIterator>
   hash_multiset(
      InputIterator _First,
      InputIterator _Last,
      const Traits& _Comp,
      const Allocator& _Al
   );
hash_multiset(
   hash_multiset&& _Right
};

Parametreler

Parametre

Tanımlama

_Al

Bunun için kullanılacak depolama ayırıcısı sınıfı hash_multiset varsayılan olarak nesnenin Allocator.

_Comp

Karşılaştırma işlevi türü const Traits içindeki öğeleri sıralamak için kullanılan hash_multiset, varsayılan olarak hash_compare.

_Right

hash_multiset Biri yapılandırılmış hash_multiset bir kopyası olacak.

_First

Kopyalanacak öğeleri aralığındaki ilk öğenin konumu.

_Last

Kopyalanacak öğeleri aralık dışına ilk öğenin konumu.

Notlar

Bütün depolamak için bellek depolama yönetir ayırıcısı nesnesi türü hash_multiset ve, daha sonra döndürülmesi çağırarak hash_multiset::get_allocator.Ayırıcı parametresi sınıf bildirimleri ve alternatif ayırıcılarına yerine kullanılan önişlem makrolar genellikle atlandı.

Bütün bunların hash_multisets başlatın.

Bütün mağaza işlevi nesne türü Traits anahtarları arasında bir sipariş oluşturmak için kullanılan hash_multiset ve, daha sonra döndürülmesi çağırarak hash_multiset::key_comp.Daha fazla bilgi için Traits bkz: hash_multiset Class konu.

Boş bir ilk ilk üç kurucuları belirtmek hash_multiset, ikinci karşılaştırma işlevi türü belirtme (_Comp) öğelerini ve üçüncü sırası oluşturma işleminde kullanılacak ayırıcı açıkça belirterek yazın (_Al) kullanılacak.Anahtar sözcük explicit belirli türde otomatik tür dönüşümü bastırır.

Dördüncü yapıcı bir kopyasını belirtir hash_multiset_Right.

Sonraki üç kurucuları aralığı kopyalayın [_First,_Last), bir hash_multiset ile karşılaştırma işlevi sınıf karşılaştırın ve ayırıcısı türünü belirleyen, explicitness artıyor.

Son yapıcı taşır hash_multiset_Right.

Gerçek karma kümesi kapsayıcı içindeki öğelerin sırasını ve tek başına sıralama işlevi tarafından yeri belirlendi kümesi kapsayıcı ile verebilir gibi genel olarak, bilinemez karma işlev, sıralama işlevi ve geçerli karma tablo boyutu bağlıdır.

Örnek

// hash_multiset_hash_multiset.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_multiset <int>::iterator hms1_Iter, hms3_Iter, hms4_Iter,
      hms5_Iter, hms6_Iter, hms7_Iter;
   hash_multiset <int, hash_compare <int, greater<int> > >::iterator
      hms2_Iter;

   // Create an empty hash_multiset hs0 of key type integer
   hash_multiset <int> hs0;

   // Create an empty hash_multiset hms1 with the key comparison
   // function of less than, then insert 4 elements
   hash_multiset <int, hash_compare <int, less<int> > > hms1;
   hms1.insert( 10 );
   hms1.insert( 20 );
   hms1.insert( 30 );
   hms1.insert( 40 );

   // Create an empty hash_multiset hms2 with the key comparison
   // function of geater than, then insert 2 elements
   hash_multiset <int, hash_compare <int, greater<int> > > hms2;
   hms2.insert( 10 );
   hms2.insert( 20 );

   // Create a hash_multiset hms3 with the 
   // allocator of hash_multiset hms1
   hash_multiset <int>::allocator_type hms1_Alloc;
   hms1_Alloc = hms1.get_allocator( );
   hash_multiset <int> hms3( hash_compare <int, less<int> >( ),
      hms1_Alloc );
   hms3.insert( 30 );

   // Create a copy, hash_multiset hms4, of hash_multiset hms1
   hash_multiset <int> hms4( hms1 );

   // Create a hash_multiset hms5 by copying the range hms1[_First, _Last)
   hash_multiset <int>::const_iterator hms1_bcIter, hms1_ecIter;
   hms1_bcIter = hms1.begin( );
   hms1_ecIter = hms1.begin( );
   hms1_ecIter++;
   hms1_ecIter++;
   hash_multiset <int> hms5( hms1_bcIter, hms1_ecIter );

   // Create a hash_multiset hms6 by copying the range hms4[_First, _Last)
   // and with the allocator of hash_multiset hms2
   hash_multiset <int>::allocator_type hms2_Alloc;
   hms2_Alloc = hms2.get_allocator( );
   hash_multiset <int> hms6( hms4.begin( ), ++hms4.begin( ), 
      less<int>( ), hms2_Alloc );

   cout << "hms1 = ";
   for ( hms1_Iter = hms1.begin( ); hms1_Iter != hms1.end( );
         hms1_Iter++ )
      cout << *hms1_Iter << " ";
   cout << endl;
   
   cout << "hms2 = " ;
   for ( hms2_Iter = hms2.begin( ); hms2_Iter != hms2.end( );
         hms2_Iter++ )
      cout << *hms2_Iter << " ";
   cout << endl;

   cout << "hms3 = ";
   for ( hms3_Iter = hms3.begin( ); hms3_Iter != hms3.end( );
         hms3_Iter++ )
      cout << *hms3_Iter << " ";
   cout << endl;

   cout << "hms4 = ";
   for ( hms4_Iter = hms4.begin( ); hms4_Iter != hms4.end( );
         hms4_Iter++ )
      cout << *hms4_Iter << " ";
   cout << endl;

   cout << "hms5 = ";
   for ( hms5_Iter = hms5.begin( ); hms5_Iter != hms5.end( );
         hms5_Iter++ )
      cout << *hms5_Iter << " ";
   cout << endl;

   cout << "hms6 = ";
   for ( hms6_Iter = hms6.begin( ); hms6_Iter != hms6.end( );
         hms6_Iter++ )
      cout << *hms6_Iter << " ";
   cout << endl;

    // Create a copy, hash_multiset hms7, of hash_multiset hms1 by moving
    hash_multiset <int, hash_compare <int, less<int> > >
        hms7(move(hms1);
    cout << "hms7 =";
    for (hms7_Iter = hms7.begin(); hms7_Iter != hms7.end(); hms7_Iter++)
        cout << " " << hms7_Iter -> second;
    cout << endl;
}

Çıktı

hms1 = 40 10 20 30 
hms2 = 10 20 
hms3 = 30 
hms4 = 40 10 20 30 
hms5 = 40 10 
hms6 = 40 
hms7 = 40 10 20 30 

Gereksinimler

Başlık: <hash_set>

Ad alanı: stdext

Ayrıca bkz.

Başvuru

hash_multiset Class

Standart Şablon Kütüphanesi