C++ Header file template
<p>I am using a template in a header file. The function I am using is recursive and I would like to keep two variables outside of the function to compare against. Here is my code (note: does not compile):</p>

<pre><code>#include "Position.h"
#ifndef _SOLVER_H
#define _SOLVER_H

class Solver{
  public:
    template&lt;typename T&gt;
    int EvaluatePosition(T &amp;p, bool me) {
        int score = 0;
        if(p.isGameOver()) {
            return p.score(me);
        }
        else {
            std::vector&lt;T&gt; nextMoves = p.getNextPositions();
            for(int i=0; i != nextMoves.size(); i++) {
                score += EvaluatePosition(nextMoves[i],!me);
                if(score &gt; maxScore) {
                    p.display();
                    maxScore = score;
                    maxP = p;
                    p.display();
                }
            }
            return score;
        }
    }

    T maxP; // Want this to be the same Type T that is used in the function
    int maxScore;
};

#endif
</code></pre>

<p>I am trying to create a variable of the same generic type as the <code>T</code> used in the function so that I can save out some data. Is this possible, and if it is, how would it be done?</p>
