다음을 통해 공유


set::value_type

요소 집합의 용량 값으로 저장 된 개체를 설명 하는 형식입니다.

typedef Key value_type;

설명

value_type템플릿 매개 변수는 동일 Key.

에 대 한 자세한 내용은 Key, 설명 절을 참조 하십시오의 set Class 항목.

이때 모두 key_typevalue_type 동의어에 대 한 템플릿 매개 변수는 .두 형식 집합과 구분 되는, 지도 multimap 클래스와의 호환성에 대 한 동일 multiset 클래스를 제공 합니다.

예제

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

int main( )
{
   using namespace std;
   set <int> s1;
   set <int>::iterator s1_Iter;

   set <int>::value_type svt_Int;   // Declare value_type
   svt_Int = 10;            // Initialize value_type

   set <int> :: key_type skt_Int;   // Declare key_type
   skt_Int = 20;             // Initialize key_type

   s1.insert( svt_Int );         // Insert value into s1
   s1.insert( skt_Int );         // Insert key into s1

   // A set accepts key_types or value_types as elements
   cout << "The set has elements:";
   for ( s1_Iter = s1.begin( ) ; s1_Iter != s1.end( ); s1_Iter++)
      cout << " " << *s1_Iter;
   cout << "." << endl;
}
  

요구 사항

헤더: <set>

네임 스페이스: std

참고 항목

참조

set Class

표준 템플릿 라이브러리