hash_multiset::swap
[!メモ]
この API は、互換性のために残されています。代わりに unordered_multiset クラスです。
2個のhash_multisetsの要素を交換します。
void swap(
hash_multiset& _Right
);
パラメーター
- _Right
ターゲットのhash_multisetと交換する要素を提供する引数のhash_multiset。
解説
このメンバー関数は、要素を交換される2種類のhash_multisetsの指定要素の参照、ポインター、または反復子を無効にしません。
Visual C++ .NET 2003では、<hash_map> と <hash_set> ヘッダー ファイルのメンバーはstdの名前空間に存在しなくなりましたが、ではなくstdextの名前空間に型。詳細については、「The stdext Namespace」を参照してください。
使用例
// 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;
}
必要条件
ヘッダー: <hash_set>
名前空間: のstdext