C++ Pointer returning NULL
<p>Trying to update to a pointer from a function return. Just for background this is a template that acts like the stl vector. This is the returning function. </p>

<pre><code>    ////////////////////////////////////////////////////////////////////////////////
//removes an item from the array
const T&amp; remove(int pos)
{
    if(pos &gt; cnt)
        pos = cnt;
    if(pos &lt; 0)
        pos = 0;
    static T v;
    for(int i,k = 0; i &lt; cnt; i++,k++)
    {
        if(i == pos)
        {
            v = element[i];
            i++;
        }
        else
            element[k] = element[i];
    }
    cnt--;
    return v;
}

/////////////////////////////////////////////////////////////////////////
</code></pre>

<p>The pointer variable I am trying to update:</p>

<pre><code>TVector&lt;Member*&gt; members;
Member* backmember;

backmember = members.remove(members.size()-1);
</code></pre>

<p>but backmember always returns null. I am sure I am missing something simple, just not sure what. Any ideas? Let me know if you have any questions and thanks in advance.</p>
