다음을 통해 공유


set::size

집합에 있는 요소 수를 반환합니다.

size_type size( ) const;

반환 값

The current length of the set.

예제

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

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

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

요구 사항

헤더: <설정>

네임스페이스: std

참고 항목

참조

set 클래스

set::size(STL 샘플)

표준 템플릿 라이브러리