title: Trouble with dependent types in templates
body: <p>I'm having trouble with templates and dependent types:</p>
  
  <pre><code>namespace Utils
  {
      void PrintLine(const string&amp; line, int tabLevel = 0);
      string getTabs(int tabLevel);
  
      template&lt;class result_t, class Predicate&gt;
      set&lt;result_t&gt; findAll_if(typename set&lt;result_t&gt;::iterator begin, set&lt;result_t&gt;::iterator end, Predicate pred) // warning C4346
      {
          set&lt;result_t&gt; result;
          return findAll_if_rec(begin, end, pred, result);
      }
  }
  
  namespace detail
  {
      template&lt;class result_t, class Predicate&gt;
      set&lt;result_t&gt; findAll_if_rec(set&lt;result_t&gt;::iterator begin, set&lt;result_t&gt;::iterator end, Predicate pred, set&lt;result_t&gt; result)
      {
          typename set&lt;result_t&gt;::iterator nextResultElem = find_if(begin, end, pred);
          if (nextResultElem == end)
          {
              return result;
          }
          result.add(*nextResultElem);
  
          return findAll_if_rec(++nextResultElem, end, pred, result);
      }
  }
  </code></pre>
  
  <p>Compiler complaints, from the location noted above:</p>
  
  <pre><code>warning C4346: 'std::set&lt;result_t&gt;::iterator' : dependent name is not a type. prefix with 'typename' to indicate a type
  error C2061: syntax error : identifier 'iterator'
  </code></pre>
  
  <p>What am I doing wrong?</p>