how can i get the front or top element of a vector queue?
<p>I didn't put the full code because it was very long and i only need help with the small portion which is the **** area. i can't seem to use front() or top() to get the top element of the queue. I tried making top() function List keep getting error : 1) class List has no memeber named 'top' which means i don't have a function top in List, when i make it it says 2) no match for 'operator=' in printer_cpu[i] = SList::top() with T=PCB]()'</p>

<pre><code>template &lt;class T&gt;
class node{
public:
T data;
node *next;
};

template &lt;class T&gt;
class List{

node&lt;T&gt; *head;
node&lt;T&gt; *tail;

public:

List()
{
    head = tail = NULL;
}

bool isEmpty()
{
    if(head == NULL) return true;
    else             return false;
}

void enqueue(T new_data){
    node&lt;T&gt; *temp = new node&lt;T&gt;;
    temp-&gt;data = new_data;
    temp-&gt;next = NULL;
    if(isEmpty()){
        head = temp;
        tail = temp;
    }
    else{
        tail-&gt;next = temp;
        tail = temp;
    }
}
void dequeue(){
    if(isEmpty())
    {
        cout &lt;&lt; "The list is already empty" &lt;&lt; endl;
    }

    node&lt;T&gt;* temp;
    if(head == tail){
        temp-&gt;data=head-&gt;data;
        delete head;
        head = tail = NULL;
    }
    else{
        temp-&gt;data = head-&gt;data;
        head = head-&gt;next;
        delete temp;
    }
}
node&lt;T&gt; top()  // need help here ****
{ 
     return head;
}

void display(){
    node&lt;T&gt; *current = head;
    while(current != NULL){
        cout &lt;&lt; current-&gt;data &lt;&lt; endl;
        current = current-&gt;next;
    }
}


};


struct PCB
{
    int ProcessID;
    int ProcessorSize;
    int priority;
    string name;
};
typedef List&lt;PCB&gt; printing;
typedef List&lt;PCB&gt; disk;

void gen(vector&lt;printing&gt; &amp;printer_queue,string printer_name[], int printers)
{
    for(int i = 0; i &lt; printers; i++)
    {
        int num = i+1;
        ostringstream convert;
        convert &lt;&lt; num;
        printer_name[i] = "p" + convert.str();
        printer_queue.push_back(printing());
    }
int main()
{
        int numOfPrinter = 5;
        string interrupt;
        cin &gt;&gt; interrupt;
        PCB cpu;
        PCB printer_cpu[numOfPrinter];
        string printer_name[numOfPrinter];
        vector&lt;printing&gt; PQ;
        gen(PQ,printer_name,numOfPrinter);
        for(int i = 0; i &lt; numOfPrinter; i++)
        {
              if(interrupt == printer_name[i])
              {
                   cout &lt;&lt; "Enter a name for this printer file: " &lt;&lt; endl;
                   cin &gt;&gt; cpu.name;
                   PQ[i].enqueue(cpu);
                   printer_cpu[i] = PQ[i].top(); //need help here ****
              }

        }
}
</code></pre>