priority_queue::size
Priority_queue에서 요소의 개수를 반환합니다.
size_type size( ) const;
반환 값
현재 길이 priority_queue입니다.
예제
// pqueue_size.cpp
// compile with: /EHsc
#include <queue>
#include <iostream>
int main( )
{
using namespace std;
priority_queue <int> q1, q2;
priority_queue <int>::size_type i;
q1.push( 1 );
i = q1.size( );
cout << "The priority_queue length is " << i << "." << endl;
q1.push( 2 );
i = q1.size( );
cout << "The priority_queue length is now " << i << "." << endl;
}
요구 사항
헤더: <queue>
네임 스페이스: std