title: Check template argument of Base class against values in Derived
body: <p>Lets assume I have an interface class (made-up example, not real code) like </p>
  
  <pre><code>template &lt;int year&gt;
  class Car {
  public: 
    virtual void move(double x, double y) = 0;
    // etc etc
  };
  </code></pre>
  
  <p>and a lot of derived classes like</p>
  
  <pre><code>template &lt;int year&gt;
  class Model8556 : virtual public Car&lt;year&gt; {
  private: 
    void move(double x, double y) {
      // ...
    }
    int yearMax = 2000; // different for every model
    int yearMin = 1990;
    // etc etc
  };
  </code></pre>
  
  <p>and I choose the model somewhere via</p>
  
  <pre><code>Car&lt;foo&gt;* myCar;    
  switch (bar) {
    case 1: myCar = new model3434&lt;foo&gt;(); break;
    case 2: myCar = new model8295&lt;foo&gt;(); break;
    // etc
  }
  </code></pre>
  
  <p><strong>I do want to check the template argument of Car (or better: of the derived classes) at compile time</strong>. I want the  template argument year to stay in a certain range (i.e. between yearMin and yearMax). However: this certain range differs between the derived classes. (edit:) <strong>As there are a lot of derived classes, I would prefer a solution within Car.</strong></p>
  
  <p>How could I achieve this behaviour? Or is this bad design?</p>
  
  <p>Any help is appreciated.</p>