home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,225 of 33,346   
   Peter Liedermann to no.spam.here@its.invalid   
   Re: stl clear and erase.   
   01 May 12 06:18:42   
   
   From: peter09876@hispeed.ch   
      
   On Tue, 01 May 2012 00:42:11 +0200, red floyd   
    wrote:   
      
   > On 4/30/2012 1:11 PM, Peter Liedermann wrote:   
   >   
   >> One very short question concerning your example:   
   >>>   
   >>> void test(std::vector& i)   
   >>> {   
   >>> i.erase(i.begin(), i.end());   
   >>> }   
   >>>   
   >>   
   >> Does the "&" make any difference here and which? Is it maybe the   
   >> cause of my troubles that I presently do not have it?   
   >>   
   >   
   > Yes.  if you do not have the &, you are erasing a *COPY* of the   
   > vector, and the original vector is unmodified.   
      
   Oh yes, sorry for the stupid question.  I was thinking of something   
   completely different, vector i versus vector i   
      
   Maybe i should use the screen magnifier:)   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca