title: type/value mismatch in template C++ class declaration
body: <p>I am trying to compile the following code on Linux using gcc 4.2:</p>
  
  <pre><code>#include &lt;map&gt;
  #include &lt;list&gt;
  
  template&lt;typename T&gt;
  class A
  {
  ...
  
  private:
      std::map&lt;const T, std::list&lt;std::pair&lt;T, long int&gt; &gt;::iterator&gt; lookup_map_;
      std::list&lt;std::pair&lt;T, long int&gt; &gt; order_list_;
  
  };
  </code></pre>
  
  <p>When I compile this class I receive the following message from gcc:</p>
  
  <pre><code>error: type/value mismatch at argument 2 in template parameter list for ‘template&lt;class _Key, class _Tp, class _Compare, class _Alloc&gt; class std::map’
  error:   expected a type, got ‘std::list&lt;std::pair&lt;const T, long int&gt;,std::allocator&lt;std::pair&lt;const T, long int&gt; &gt; &gt;::iterator’
  error: template argument 4 is invalid
  </code></pre>
  
  <p>I have removed file names and line numbers , but they all refer to the line declaring the map.</p>
  
  <p>When I replace the pair in these expressions with an int or some concrete type, it compiles fine.  Can someone please explain to me what I am doing wrong.</p>