title: Best Practice: QT4 QList<Mything*>... on Heap, or QList<Mything> using reference?
body: <p>Learning C++, so be gentle :)...</p>
  
  <p>I have been designing my application primarily using heap variables (coming from C), so I've designed structures like this:</p>
  
  <pre><code>QList&lt;Criteria*&gt; _Criteria;
  // ...
  Criteria *c = new Criteria(....);
  _Criteria.append(c);
  </code></pre>
  
  <p>All through my program, I'm passing pointers to specific Criteria, or often the list.  So, I have a function declared like this:</p>
  
  <pre><code>QList&lt;Criteria*&gt; Decision::addCriteria(int row,QString cname,QString ctype);
  Criteria * Decision::getCriteria(int row,int col)
  </code></pre>
  
  <p>which inserts a Criteria into a list, and returns the list so my GUI can display it.</p>
  
  <p>I'm wondering if I should have used references, somehow.  Since I'm always wanting that exact Criteria back, should I have done:</p>
  
  <pre><code>QList&lt;Criteria&gt; _Criteria;
  // ....
  Criteria c(....);
  _Criteria.append(c);
  </code></pre>
  
  <p>...</p>
  
  <pre><code>QList&lt;Criteria&gt;&amp; Decision::addCriteria(int row,QString cname,QString ctype);
  Criteria&amp; Decision::getCriteria(int row,int col)
  </code></pre>
  
  <p>(not sure if the latter line is syntactically correct yet, but you get the drift).  </p>
  
  <p>All these items are specific, quasi-global items that are the core of my program.</p>
  
  <p>So, the question is this:  I can certainly allocate/free all my memory w/o an issue in the method I'm using now, but is there are more C++ way?  Would references have been a better choice (it's not too late to change on my side).</p>
  
  <p>TIA</p>
  
  <p>Mike</p>