title: declare a vector through decltype
body: <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  
  #include &lt;vector&gt;
  #include &lt;map&gt;
  
  template &lt;typename T&gt;
  auto Copy(T c)
  {
      std::vector&lt;decltype(c.begin()-&gt;first)&gt; lc;
  
     //Copying
  
      return lc;
  
  }
  
  int main()
  {
      std::map&lt;int, int&gt; map;
  
      Copy(map);
  
  
      return 0;
  }
  </code></pre>
  
  <p>In the above code I am trying declare a <code>vector</code> from the datatype of keys of <code>map</code> but I am getting following error -  </p>
  
  <pre><code>"The C++ Standard forbids containers of const elements allocator&lt;const T&gt; is ill-formed." 
  </code></pre>