title: Is it possible to use to use QMultiMap::ConstIterator in own template class?
body: <p>I want to iterate over a <code>QMultiMap</code> using </p>
  
  <pre><code>QMultiMap&lt;double, TSortable&gt;::const_iterator it;`
  </code></pre>
  
  <p>but the compiler complains </p>
  
  <pre><code>error: expected ‘;’ before ‘it’
  </code></pre>
  
  <p>resulting in a </p>
  
  <pre><code>error: ‘it’ was not declared in this scope
  </code></pre>
  
  <p>for every usage. I tried <code>ConstIterator</code>, <code>const_iterator</code> and even the slower <code>Iterator</code> without any success. Is it even possible to use Q(Multi)Map with a template class? Why can't I declare an Iterator when definition (as void*) is ok?</p>
  
  <p>I use the following code (include guard omitted):</p>
  
  <pre><code>#include &lt;QtCore/QDebug&gt;
  #include &lt;QtCore/QMap&gt;
  #include &lt;QtCore/QMultiMap&gt;
  #include &lt;limits&gt;
  
  /** TSortable has to implement minDistance() and maxDistance() */
  template&lt;class TSortable&gt;
  class PriorityQueue {
  public:
  
    PriorityQueue(int limitTopCount)
        : limitTopCount_(limitTopCount), actMaxLimit_(std::numeric_limits&lt;double&gt;::max())
    {
    }
  
    virtual ~PriorityQueue(){}
  
  private:
    void updateActMaxLimit(){
      if(maxMap_.count() &lt; limitTopCount_){
        // if there are not enogh members, there is no upper limit for insert
        actMaxLimit_ = std::numeric_limits&lt;double&gt;::max();
        return;
      }
      // determine new max limit
  
      QMultiMap&lt;double, TSortable&gt;::const_iterator it;
      it = maxMap_.constBegin();
      int act = 0;
      while(act!=limitTopCount_){
        ++it;// forward to kMax
      }
      actMaxLimit_ = it.key();
  
    }
  
    const int limitTopCount_;
    double actMaxLimit_;
    QMultiMap&lt;double, TSortable&gt; maxMap_;// key=maxDistance
  };
  </code></pre>