title: How to define a static const variable of a template class
body: <p>I'm trying to make a vector class with predefined static constants for up, right and forward because these should be the same in all cases. How should this be defined and is it even possible?</p>
  
  <p>I'm trying to do something like this:</p>
  
  <pre><code>template &lt;class T&gt; class vec3
  {
  public:
      vec3(T x = 0, T y = 0, T z = 0) :
          x(x),
          y(y),
          z(z)
      {
      }
  
      static const vec3&lt;T&gt; right;
      static const vec3&lt;T&gt; up;
      static const vec3&lt;T&gt; forward;
  
      T x, y, z;
  }
  </code></pre>
  
  <p>cpp:</p>
  
  <pre><code>#include "vec3.h"
  
  template &lt;typename T&gt;
  const vec3&lt;T&gt;::right(1, 0, 0);
  
  template &lt;typename T&gt;
  const vec3&lt;T&gt;::up(0, 1, 0);
  
  template &lt;typename T&gt;
  const vec3&lt;T&gt;::forward(0, 0, 1);
  </code></pre>
  
  <p>This results in a syntax error.</p>