Beispiel #1
0
forward_list<T> listCopy(forward_list<T> L, forward_list<T> &P){
    //concatenate L - in reverse - to the back of P
    forward_list<T> temp;
    while(!L.empty()){
        temp.push_front(L.front());
        L.pop_front();
    }
    
    P.reverse();
    while(!P.empty()){
        temp.push_front(P.front());
        P.pop_front();
    }
    
    P = temp;
    return P;   
}