다음을 통해 공유


priority_queue::push

요소에서 연산자의 우선 순위에 따라 우선 순위 대기열에 추가 <.

void push(
   const Type& _Val
);

매개 변수

  • _Val
    Priority_queue의 맨 위에 추가 되는 요소입니다.

설명

위쪽에는 priority_queue 컨테이너에 큰 요소를 차지 하는 위치입니다.

예제

// pqueue_push.cpp
// compile with: /EHsc
#include <queue>
#include <iostream>

int main( )
{
   using namespace std;
   priority_queue<int> q1;

   q1.push( 10 );
   q1.push( 30 );
   q1.push( 20 );

   priority_queue<int>::size_type i;
   i = q1.size( );
   cout << "The priority_queue length is " << i << "." << endl;

   const int& ii = q1.top( );
   cout << "The element at the top of the priority_queue is "
        << ii << "." << endl;
}
  
  

요구 사항

헤더: <queue>

네임 스페이스: std

참고 항목

참조

priority_queue Class

priority_queue Functions

표준 템플릿 라이브러리