Sunday, 15 September 2013

c++ - How to initialize a queue with n default values? -


Say I have a class with default constructor. How do I start the queue in concert by its size and a default value I can do

  class StandardClass {}; // a vector to 5 default standard squared std :: vector & lt; StandardClass & gt; To begin with. Vec (5, StandardClass ());  

How can I do this with queue?

  std :: queue & lt; StandardClass & gt; Q (5, standardclass ()); ???  

If you eg You will see that you can give an example of the underlying container (by default).

So you should be able to do something like

  std :: queue & lt; Standardclass & gt; Que (std :: deque & lt; standardclass & gt; (5));  

No comments:

Post a Comment