even one more template question

T

Tony Johansson

Hello experts!

Can somebody give me some example when this Stack<List<T> > s;
is used. I do know what this Stack<int> s; and this means List<int> l;

Many thanks

//Tony
 
V

Victor Bazarov

Tony said:
Can somebody give me some example when this Stack<List<T> > s;
is used. I do know what this Stack<int> s; and this means List<int> l;

The type

Stack<List<whatever> >

would be used when you need a stack of lists of whatever. If you don't
need a stack of lists, don't use it.

Get yourself a book on data structures and algorithms. In it you might
come across a vector of lists or a hash map of stacks or something like
that. Such combinations are probably an order of magnitude (or more)
rarer than "regular" containers. The most frequent I've used was probably
vector<vector<something> >.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top