次の方法で共有


multiset::reference

要素への参照を提供する型は複数のセットに格納されている

typedef typename allocator_type::reference reference;

使用例

// multiset_ref.cpp
// compile with: /EHsc
#include <set>
#include <iostream>

int main( )
{
   using namespace std;   
   multiset <int> ms1;

   ms1.insert( 10 );
   ms1.insert( 20 );

   // Declare and initialize a reference &Ref1 to the 1st element
   const int &Ref1 = *ms1.begin( );

   cout << "The first element in the multiset is "
        << Ref1 << "." << endl;
}
  

必要条件

ヘッダー: <set>

名前空間: std

参照

関連項目

multiset Class

標準テンプレート ライブラリ