Writing templete class Liste get problems
<p>My teacher asked to write a templete class List(just like in the STL)
My code compile but it will crash but I CAN`T find why, can anyone try to help me?
I think maybe there is problem with the constructor with two parameters?</p>

<pre><code>-----Main.cpp------
#include "Liste.h"
#include &lt;iostream&gt;

int main()
{
    Liste&lt;int&gt; l ;
    int x = 5 ;
    int y = 6 ;
    int z = 7 ;
    l.insert_first(y) ;
    l.insert_first(x) ;
    l.insert_last(z) ;
    std::cout &lt;&lt; l &lt;&lt; std::endl ;
}

-----Liste.h------
#pragma once
#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include "NoeudListe.h"

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

private:
    NoeudListe&lt;T&gt;* tete;
    NoeudListe&lt;T&gt;* fin;

public:

    Liste()
    {
        tete = new NoeudListe&lt;T&gt;(NULL,fin,NULL);   //&lt;-----I think the problem lies here beacause the val can`t be NULL? But I tried 0, still not work...
        fin  = new NoeudListe&lt;T&gt;(tete,NULL,NULL);
    }

    void insert_after (T&amp; val, NoeudListe&lt;T&gt;* location)
    {
        NoeudListe&lt;T&gt;* local = new NoeudListe&lt;T&gt;(location,location-&gt;getNext(),val);
        (*(location-&gt;getNext())).setPrev(local);
        location-&gt;setNext(local);
    }

    void insert_first(T&amp; val)
    {
        insert_after (val, tete);
    }

    void insert_last(T&amp; val)
    {
        insert_after (val, fin-&gt;getPrev());
    }

    friend std::ostream&amp; operator &lt;&lt; (std::ostream&amp; os,const Liste&lt;T&gt;&amp; location)
    {
        NoeudListe&lt;T&gt;* local=(location.tete)-&gt;getNext();
        while( local-&gt;getVal() != NULL )
        {
            os&lt;&lt; local-&gt;getVal() &lt;&lt; "\n";
            local=local-&gt;getNext();
        }
        return os;
    }
};

-----NoeudListe.h------
#pragma once
template &lt;class T&gt; class NoeudListe
{

private:
    NoeudListe* prev;
    NoeudListe* next;
    T val;

public:

    NoeudListe(NoeudListe* p, NoeudListe* n, const T&amp; v)
    {
        prev = p;
        next = n;
        val = v;
    }

    void setNext(NoeudListe* n){ next = n;}
    void setPrev(NoeudListe* p){ prev = p;}
    void setVal(const T&amp; v){ val = v;}

    NoeudListe* getNext(){ return next;}
    NoeudListe* getPrev(){ return prev;}
    T getVal(){ return val;}

};
</code></pre>