public member function
void push ( const T& x );
Adds a new element at the end of the queue
, after its current last element. The content of this new element is initialized to a copy of x
This member function effectively calls the member function push_back
of the underlying container object.
- Value to be copied to the new element.
T is the first template parameter (the type of the elements stored in the queue).
using namespace std;
int main ()
cout << "Please enter some integers (enter 0 to end):\n";
cin >> myint;
} while (myint);
cout << "myqueue contains: ";
cout << " " << myqueue.front();
The example uses push
to add a new elements to the queue, which are then popped out in the same order.
- Delete next element (public member function)
- Return size (public member function)