Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Appendix 1: queue class 1. template class Item> 2. class queue 3. public: /I TYPEDEFS and MEMBER CONSTANTS typedef std::size t size type; typedef Item
Appendix 1: queue class 1. template class Item> 2. class queue 3. public: /I TYPEDEFS and MEMBER CONSTANTS typedef std::size t size type; typedef Item value_type; 8 static const size type CAPACITY-30; 9 10 11. 12. 13. 14. 15. 16. // CONSTRUCTOR and DESTRUCTOR queue(size-type queue (const queue& source); queue(); initial-capacity CAPACITY); = // MODIFICATION MEMBER FUNCTIONS Item& front(); void pop (); void push (const Item & entry); void reserve(size type new_capacity); 18. 19. 20 21. 22. 23. 24. 25. 26. private: 27. 28. 29. 30 31. 32. 33. 34. X; // CONSTANT MEMBER FUNCTIONS bool empty() const { return (count == 0); const Item &front() const; size_type size() const return count; // Circular array Item* data; size type first; size type last; size_type count; size type capacity; II HELPER MEMBER FUNCTION // Index of item at front of the queue // Index of item at rear of the queue // Total number of items in the queue size-type next-index(size-type i) const { return (1 1) % capacity; } +
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started