title: How to traverse stack in C++?
body: <p>Is it possible to traverse <code>std::stack</code> in C++?</p>
  
  <p>Traversing using following method is not applicable. Because <code>std::stack</code> has no member <code>end</code>.</p>
  
  <pre><code>std::stack&lt;int&gt; foo;
  
  // ..
  
  for (__typeof(foo.begin()) it = foo.begin(); it != foo.end();  it++)
  {
      // ...
  }
  </code></pre>