次の方法で共有


multiset::size

多重セット内の要素数を返します。

size_type size( ) const;

戻り値

多重セットの現在の長さ。

使用例

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

int main( )
{
   using namespace std;   
   multiset <int> ms1;
   multiset <int> :: size_type i;
   
   ms1.insert( 1 );
   i = ms1.size( );
   cout << "The multiset length is " << i << "." << endl;

   ms1.insert( 2 );
   i = ms1.size( );
   cout << "The multiset length is now " << i << "." << endl;
}
  
  

必要条件

ヘッダー: <set>

名前空間: std

参照

関連項目

multiset Class

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