deque::size
返回中元素的数目。deque 的。
size_type size( ) const;
返回值
当前 deque 的长度。
示例
// deque_size.cpp
// compile with: /EHsc
#include <deque>
#include <iostream>
int main( )
{
using namespace std;
deque <int> c1;
deque <int>::size_type i;
c1.push_back( 1 );
i = c1.size( );
cout << "The deque length is " << i << "." << endl;
c1.push_back( 2 );
i = c1.size( );
cout << "The deque length is now " << i << "." << endl;
}
要求
标头: <deque>
命名空间: std