title: Use a template inside a template that have the same type
body: <p>im doing a project for school and i have a problem with templates : i'd like to use a template with the same type as my actual template in its constructor but i come with this error : declaration incompatible with "my construcor".</p>
  
  <p>Here's the code :</p>
  
  <pre class="lang-cpp prettyprint-override"><code>template &lt;typename Type&gt; class CMatrixIterator : public CIterator
  {
        CMatrixIterator(CMatrix&lt;Type&gt;&amp; MATmatrice);
  }
  
  template &lt;typename Type&gt;
  inline CMatrixIterator&lt;Type&gt;::CMatrixIterator(CMatrix&lt;Type&gt;&amp; MATmatrice) : iIndex(0), MATmatrice(MATmatrice)
  {
  }
  </code></pre>
  
  <p>and the full error :</p>
  
  <pre><code>declaration incompatible with "CMatrixIterator&lt;Type&gt;::CMatrixIterator(&lt;error-type&gt; &amp; MATmatrice)
  </code></pre>
  
  <p>I dont understand why i get this error does anyone have an idea ?
  Thanx.</p>
  
  <p>full code :</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#pragma once
  #include "CIterator.h"
  #include "CMatrix.h"
  
  template &lt;typename Type&gt; class CMatrixIterator : public CIterator
  {
      private:
          int iIndex;
          CMatrix&lt;Type&gt;&amp; MATmatrice;
  
      public:
          CMatrixIterator(CMatrix&lt;Type&gt;&amp; MATmatrice);
          ~CMatrixIterator();
  
          virtual Type ITEfirst();
          virtual bool ITEisDone();
          virtual void ITEnext();
          virtual Type ITEcurrentItem();
  };
  
  
  
  template &lt;typename Type&gt;
  inline CMatrixIterator&lt;Type&gt;::CMatrixIterator(CMatrix&lt;Type&gt;&amp; MATmatrice) : iIndex(0), MATmatrice(MATmatrice)
  {
  }
  
  template&lt;typename Type&gt;
  inline CMatrixIterator&lt;Type&gt;::~CMatrixIterator()
  {
  }
  
  template&lt;typename Type&gt;
  inline Type CMatrixIterator&lt;Type&gt;::ITEfirst()
  {
      return MATmatrice.getValues(0, 0);
  }
  
  template&lt;typename Type&gt;
  inline bool CMatrixIterator&lt;Type&gt;::ITEisDone()
  {
      return MATmatrice.MATrows * MATmatrice.MATcols() &gt; index ? true : false;
  }
  
  template&lt;typename Type&gt;
  inline void CMatrixIterator&lt;Type&gt;::ITEnext()
  {
      iIndex++;
  }
  
  template&lt;typename Type&gt;
  inline Type CMatrixIterator&lt;Type&gt;::ITEcurrentItem()
  {
      return MATmatrice.MATgetValues(iIndex % MATmatrice.MATcols, iIndex / MATmatrice.MATcols);
  }
  </code></pre>