If I do not to want to create a new container in order to do so?
ostream & operator<<(ostream & os, stack my_stack) //function header
{
while(!my_stack.empty()) //body
{
os << my_stack.top() << " ";
my_stack.pop();
}
return os; // end of function
}
/*
using this simple overloaded operator function, you're able to print out all the components of a stack by doing a simple cout << your_stack_name;*/