title: object dies in a loop c++ simple list
body: <p>I have a list of Movie class, and I want to add them all together into one Movie instance. problem is, from that loop doesn't do the operator + as expected becuase it runs over a list of pointers that's inside, copying only the rest of the data. operator+ must be fine, because when I add Movies without using a loop it performs as expected, so I will leave it empty and post here the return value and arguments.</p>
  
  <p>the loop is (Movie final is a class member)</p>
  
  <pre><code>   Movie g,temp;
     int i=0;
     //moviesToAdd is a list, performing as expected (checked before)
  
     for (std::list&lt;Movie&gt;::iterator it2=moviesToAdd.begin(); i != 
     moviesToAdd.size(); ++it2) 
      {
          temp=final;
          i++;
          g = *it2;
         final =  temp + g;
  
        if(i==moviesToAdd.size())
           {
            break;
           }                  
      }//end for*/
  </code></pre>
  
  <p>this is operator +, = who work perfectly fine so I leave only this:</p>
  
  <pre><code>Movie Movie:: operator+ (const Movie&amp; other) const{
  Movie toReturn;
  ////some code///
  return toReturn; }
  
  Movie&amp; Movie:: operator= (const Movie&amp; other) {
  ///////some code////
  return *this; }
  </code></pre>
  
  <p>as I mentioned - they work as well not using this loop, so problem must be inheritted in this loop not being able to copy a list of pointers which is a class member of Movie.</p>
  
  <p>HELP..?</p>