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,222 of 33,346   
   Francis Glassborow to Peter Liedermann   
   Re: stl clear and erase.   
   30 Apr 12 15:41:58   
   
   From: francis.glassborow@btinternet.com   
      
   On 30/04/2012 21:11, Peter Liedermann wrote:   
   > On Mon, 30 Apr 2012 14:24:29 +0200, Edward Rosten   
   >  wrote:   
   >   
   >> On Apr 29, 10:09 pm, "Peter Liedermann"  wrote:   
   >   
   > First of all, thank you for taking the time to answer, I still have to   
   > analyze this.   
   >   
   > 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?   
      
   A rather large difference, the difference between operating on the   
   original and operating on a copy. Without the & the function has no   
   effects on the code calling test.   
      
      
   --   
         [ 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