Is the following code guaranteed by the standard to work(assuming st is not empty)?
#include
#include
int main()
{
extern std::st
According to this page, std::stack uses a container class to store elements.
I guess what you suggest works only if the containter store its elements in a linear way (std::vector).
As a default, std::stack uses a std::deque which, as far as I know, doesn't meet this requirement. But If you specify a std::vector as a container class, I can't see a reason why it shoudln't work.