다음을 통해 공유


set::const_reference

에 대 한 참조를 제공 하는 형식에 const 읽기 및 수행에 대 한 저장 요소 const 작업.

typedef typename allocator_type::const_reference const_reference;

예제

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

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

   s1.insert( 10 );
   s1.insert( 20 );

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

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

   // The following line would cause an error because the 
   // const_reference cannot be used to modify the set
   // Ref1 = Ref1 + 5;
}
  

요구 사항

헤더: <set>

네임 스페이스: std

참고 항목

참조

set Class

표준 템플릿 라이브러리