다음을 통해 공유


queue::size

Returns the number of elements in the queue.

size_type size( ) const;

반환 값

The current length of the queue.

예제

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

int main( )
{
   using namespace std;
   queue <int> q1, q2;
   queue <int>::size_type i;

   q1.push( 1 );
   i = q1.size( );
   cout << "The queue length is " << i << "." << endl;

   q1.push( 2 );
   i = q1.size( );
   cout << "The queue length is now " << i << "." << endl;
}
  

요구 사항

Header: <queue>

네임스페이스: std

참고 항목

참조

queue 클래스

queue 함수

표준 템플릿 라이브러리