Hello i bet it is just a tiny thing but i can´t find an ansewer anywhere, so in my code i get this error:
queue.cpp:33:3: error: invalid use of template-name ‘Queue_el’ without an argument list
Queue_el*<T> head<T>;
^
queue.cpp:34:3: error: invalid use of template-name ‘Queue_el’ without an argument list
Queue_el*<T> tail<T>;
^
queue.cpp: In constructor ‘Queue<T>::Queue()’:
queue.cpp:37:13: error: ‘head’ was not declared in this scope
Queue() { head=nullptr; tail=nullptr; }
^
queue.cpp:37:27: error: ‘tail’ was not declared in this scope
Queue() { head=nullptr; tail=nullptr; }
Here is the Code:
using namespace std;
template<typename T>
class Queue;
template<typename T>
class Queue_el {
private:
T value;
Queue_el* next;
Queue_el* prev;
public:
Queue_el() { value=0; next=nullptr; prev=nullptr; }
Queue_el(T n) { value=n; next=nullptr; prev=nullptr; }
friend class Queue<T>;
};
template<typename T>
class Queue {
private:
Queue_el*<T> head;
Queue_el*<T> tail;
public:
Queue() { head=nullptr; tail=nullptr; }
void push(T);
int pop();
bool empty() const;
int size() const;
};
Now i don´t understand that because I wrote
Queue_el*<T> head;
Queue_el*<T> tail;
So the list should be there.
Aucun commentaire:
Enregistrer un commentaire