title: typenamed iterator is not a type
body: <p>I'm writing a templated class, which involves use of iterators. I've found the many questions about how you need to typename an iterator if you're using it with a template, so I'm wondering why it's still not working.</p>
  
  <pre><code>#pragma once
  
  #include &lt;iterator&gt;
  #include &lt;list&gt;
  #include &lt;tuple&gt;
  
  template &lt;class T&gt;
  class Quack
  {
      private:
          std::list&lt;T&gt; data;
          typename std::list&lt;T&gt;::iterator iter;
  
      public:
          Quack();
  
          void insert(T dat);
          std::tuple&lt;T, T&gt; poppop();
  
      private:
          //error: 'iter' does not name a type
          iter binarySearch(T toFind, std::list&lt;T&gt;::iterator min, std::list&lt;T&gt;::iterator max);
  };
  </code></pre>
  
  <p>I also tried <code>typedef typename std::list&lt;T&gt;::iterator iter;</code>, but that throws up the error "std::list::iterator is not a type"</p>
  
  <p>So given that I'm using <code>typename</code>, what is it that I'm doing wrong?</p>
  
  <p>I'm using g++ 4.4.5 with the argument -std=c++0x, if it's relevant.</p>