title: C++ Inner Class Ctor and Parameters
body: <p>I am having trouble with creating the ctor for my inner class <code>ListIterator</code> inside <code>List</code>, I don't know why this isn't working:</p>
  
  <pre><code>template&lt;class T, int length&gt;
  class List {
  public:
      typedef struct Row {
          T data;
          int prev;
          int next;
      } Row;
  
      class ListIterator {
          typedef ListIterator iterator;
          public:
              ListIterator(int mPos, Row mRow) : pos(mPos) , row(mRow){}
              //methods
          private:
              int pos;
              Row row;
      };
  
      typedef ListIterator iterator;
  
      iterator begin() const;
  private:
      Row storage[length];
      int startDataIdx = 0;
  };
  
  template&lt;class T, int length&gt;
  typename List&lt;T,length&gt;::iterator
  List&lt;T, length&gt;::begin() const{
      iterator item_iterator(startDataIdx, storage[startDataIdx]);
      return(item_iterator);
  }
  </code></pre>
  
  <blockquote>
    <p>no matching function for call to 'List::ListIterator::ListIterator(const int&amp;, const Row&amp;)'</p>
  </blockquote>
  
  <p>I want to create a <code>ListIterator&lt;T&gt;</code> which the same <code>T</code> as <code>List</code> as parameter (obviously because it iterates over the same type of elements as <code>List</code> contains), how do I do that?
  Would it be better to use <code>new</code> in the method <code>begin()</code> or leave it as it is (don't use new, whatever advantages that might have)?</p>