deque::size
Returns the number of elements in the deque.
size_type size( ) const;
Return Value
The current length of the deque.
Example
// 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;
}
Output
The deque length is 1. The deque length is now 2.
Requirements
Header: <deque>
Namespace: std