vector::empty
Tests if the vector is empty.
bool empty( ) const;
Return Value
true if the vector is empty; false if the vector is not empty.
Example
// vector_empty.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>
int main( )
{
using namespace std;
vector <int> v1;
v1.push_back( 10 );
if ( v1.empty( ) )
cout << "The vector is empty." << endl;
else
cout << "The vector is not empty." << endl;
}
The vector is not empty.
Requirements
Header: <vector>
Namespace: std