title: Derive a templated class' member variable type from a template member type
body: <p>The title might seem a little confusing, so here is a more thorough explanation:</p>
  <p>I have a templated class that has a vector as a member variable. The template argument is a struct (or class) that will have one certain variable. The type of this vector shall be derived from the template argument (from this one certain variable). The tricky part is that it shall be derived from a member variable of the template argument.</p>
  <pre><code>#include &lt;vector&gt;
  #include &lt;complex&gt;
  using namespace std;
  
  struct thingA {
      double variable;
      //...
  };
  
  struct thingB {
      complex&lt;double&gt; variable;
      //...
  };
  
  
  template &lt;class S&gt;
  class someClass {
      vector&lt; &quot; type of S::variable &quot; &gt; history; // If S=thingA, make it a double, if S=tingB make it a complex&lt;double&gt;
  }
  
  // Usage:
  someClass&lt;thingA&gt; myInstanceA; // (this instance should now have a vector&lt;double&gt;)
  
  someClass&lt;thingB&gt; myInstanceB; // (this instance should now have a vector&lt;complex&lt;double&gt;&gt;)
  </code></pre>