Compartir a través de


hash_multiset::swap

NotaNota

Esta API está obsoleta.La alternativa es unordered_multiset (Clase).

Cambie los elementos de dos hash_multisets.

void swap( 
   hash_multiset& _Right 
);

Parámetros

  • _Right
    El hash_multiset el argumento que proporciona los elementos que se intercambiarán con el hash_multiset de destino.

Comentarios

La función miembro no reemplaza ninguna referencia, punteros, o iterador que los elementos denominados en los dos hash_multisets cuyos se están cambiando elementos.

En Visual C++ .NET 2003, los miembros de los archivos de encabezado <hash_map> y <hash_set> ya no están en el espacio de nombres std, sino que se han movido al espacio de nombres stdext. Vea El espacio de nombres stdext para obtener más información.

Ejemplo

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

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_multiset <int> hms1, hms2, hms3;
   hash_multiset <int>::iterator hms1_Iter;

   hms1.insert( 10 );
   hms1.insert( 20 );
   hms1.insert( 30 );
   hms2.insert( 100 );
   hms2.insert( 200 );
   hms3.insert( 300 );

   cout << "The original hash_multiset hms1 is:";
   for ( hms1_Iter = hms1.begin( ); hms1_Iter != hms1.end( );
         hms1_Iter++ )
         cout << " " << *hms1_Iter;
   cout   << "." << endl;

   // This is the member function version of swap
   hms1.swap( hms2 );

   cout << "After swapping with hms2, list hms1 is:";
   for ( hms1_Iter = hms1.begin( ); hms1_Iter != hms1.end( );
         hms1_Iter++ )
         cout << " " << *hms1_Iter;
   cout  << "." << endl;

   // This is the specialized template version of swap
   swap( hms1, hms3 );

   cout << "After swapping with hms3, list hms1 is:";
   for ( hms1_Iter = hms1.begin( ); hms1_Iter != hms1.end( );
         hms1_Iter++ )
         cout << " " << *hms1_Iter;
   cout   << "." << endl;
}
  

Requisitos

Encabezado: <hash_set>

Espacio de nombres: stdext

Vea también

Referencia

hash_multiset (Clase)

Biblioteca de plantillas estándar