0

リストを使用してこのテンプレート Queue を作成しています。リスト部分のエラーの意味がわかりません。listObject.push_back() と入力すると、プログラムはメンバー関数が見つからないことを示します。前もって感謝します

#include <iostream>
#include <list>


using namespace std;


template<class T, class E>
class Queue{

public:

// Creates a Queue with an initial capacity of 10
Queue();
//Creates a Queue object with an initial capacity of size cap
Queue(int cap);
//adds item to the end of the queue
void add(T item);
//returns true if the queue is empty
bool isEmpty() const;
//removes the front item from the qeue
T remove();
//Provide a copy of the object that is first in the queue
T first() const;
//updates the item in the front of the queue
void updateFirst(T item);
//output all information currently stored in the queue
friend ostream& operator<<(ostream& out, const Queue<E>& obj)

 private:

list<E> listObject;
int capacity;
};

 template<class T, class E>
 Queue<T,E>::Queue()
 {
capacity = 10;
 }

 template<class T, class E>
 Queue<T,E>::Queue(int cap)
 {

capacity = cap;
 }

 template<class T, class E>
  void Queue<T,E>::add(E item)
 {

listObject.push_back( item );

 }  
4

1 に答える 1

1

リスト オブジェクトは であると定義されてlist<E>いますが、タイプ のオブジェクトを push_back しようとしていますT

于 2013-11-04T05:57:22.757 に答える