I am writing the functions for a class that is templated using 3 files: qpqueue.h, qpqueue.cpp, and main.cpp
here's qpqueue.h:
When I try to compile my project, I get an error saying, "ISO C++ forbids declaration of 'queue' with no type."Code:#include <queue> const int MAXPRIORITY = 10; template <typename T> class qpqueue { public: qpqueue(); void push (const T & item, int p); // insert item with priority p, // 0 <= p <= MAXPRIORITY void pop(); // find the non-empty queue with largest index and remove its // front element // Precondition: the queue is not empty, the function throws // underflowError exception if the queue is empty T& top(); // find the non-empty queue with largest index and return // its front element. // Precondition: the queue is not empty, the function // throws the underflowErr exception if the queue is empty const T& top() const; // constant version of top(); bool empty() const; // is the queue empty? int size() const; // return the number of elements in the queue private: queue<T> priority[MAXPRIORITY +1]; // priority[i] contains all elements with priority i // in their order of insertion int pqsize; // number of elements in the priority queue };
I'm not sure if there's a problem with the implementation of my qpqueue.cpp file, or if I just need to have code in main() that actually implements the qpqueue class with a specified type. Thanks.



LinkBack URL
About LinkBacks


