Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Adds an element to the end of the deque.
void push_back(
const Type& val
);
Parameters
- val
The element added to the end of the deque.
Remarks
If an exception is thrown, the deque is left unaltered and the exception is rethrown.
Code Example
// deque_push_back.cpp
// compile with: /EHsc
#include <deque>
#include <iostream>
int main( )
{
using namespace std;
deque <int> d;
d.push_back( 1 );
d.push_back( 2 );
d.push_back( 3 );
for( deque<int>::const_iterator i = d.begin(); i != d.end(); ++i )
{
cout << *i << " ";
}
cout << endl;
d.push_front( 0 );
d.push_back( 4 );
for( deque<int>::const_iterator i = d.begin(); i != d.end(); ++i )
{
cout << *i << " ";
}
cout << endl;
}
Output
1 2 3
0 1 2 3 4
Requirements
Header: <deque>
Namespace: std
See Also
Reference
deque::push_back and deque::pop_back
Other Resources
Change History
Date |
History |
Reason |
---|---|---|
December 2008 |
Improved example. |
Customer feedback. |