title: How to store template type in structure
body: <pre><code>#include&lt;iostream&gt;
  #include&lt;typeinfo&gt;
  using namespace std;
  template &lt;class Key, class Value&gt;
  struct st
  {
          typedef Key KeyType;
          typedef Value ValueType;
  };
  int main()
  {
          st&lt;int, int&gt; st1;
          if(typeid(st1.KeyType) == typeid(int))
                  cout&lt;&lt;"Yes";
          return 0;
  }
  </code></pre>
  
  <p>Is there a way of storing the type <code>Key</code> and <code>Value</code> within the structure? Like st1 structure stores key of type <code>int</code> and value of type <code>int</code> or any template type within the structure. i want to later use it for type comparison. i get the following error.</p>
  
  <pre><code> invalid use of ‘st&lt;int, int&gt;::KeyType’
    if(typeid(st1.KeyType) == typeid(int))
  </code></pre>
  
  <p>I want to store the type with which was it initialized to to stored within the structure. </p>