title: c++ unordered map using templates
body: <p>I am trying to declare an unordered map using templates in c++. However, as I expect the object to be one of the primitive datatypes I don't want to declare a custom class for only one object.</p>
  
  <p>I've tried using :</p>
  
  <pre><code>template &lt;class T&gt; std::unordered_map&lt;int, T&gt; storedObj;
  </code></pre>
  
  <p>but I keep getting the error: <strong>‘storedObj’ was not declared in this scope</strong></p>
  
  <p>a code snippet is below</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;unordered_map&gt;
  #include&lt;deque&gt;
  
  
  
          std::deque&lt;int&gt; freeIds;
          template &lt;class T&gt; std::unordered_map&lt;int, T&gt; storedObj;
              unsigned static int objIdCount=0;
          const unsigned long int MAXID = 1000000000;
  </code></pre>
  
  <p>Can you please tell me what's wrong? Thanks.</p>