stack implementation in C++ using template
<p>In below program how can I print stack data in the member function of that class?</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;

template &lt;class T&gt;
class box{
    public :
            vector&lt;T&gt; elems;
            void push(T); // pushing data into stack
            void pop();
            void display(); // displaying the stack data
};

template &lt;class T&gt; void box&lt;T&gt; :: push(T ele)
{
    elems.push_back(ele); // pushing stack elements
}

template &lt;class T&gt; void box&lt;T&gt; :: pop(void)
{
    elems.pop_back();
}

template &lt;class T&gt; void box&lt;T&gt; :: display(box &amp;b)
{
  //How to display the data inserted in stack here??
}

int main(void)
{
    box&lt;int&gt; b;
    b.push(3);  // inserting stack data into template
    b.push(4);
    b.push(5);
    b.push(6);
    b.push(7);
}
</code></pre>

<p>I tried to print the data but it was not proper, so I am not sure how can I access the stack elements</p>