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,386 of 33,346   
   Seungbeom Kim to Dave Abrahams   
   Re: Techniques to avoid minimal scope in   
   07 Jun 12 21:21:43   
   
   From: musiphil@bawi.org   
      
   On 2012-06-07 12:02, Dave Abrahams wrote:   
   > on Wed Jun 06 2012, "Martin B." <0xCDCDCDCD-AT-gmx.at> wrote:   
   >>   
   >> Mathias, Dave - I fail to see how an algorithm could help. I really   
   >> don't get it.   
   >>   
   >> Can you provide an example where an algorithm based solution avoids   
   >> the inefficiencies associated with declaring the temporary complex   
   >> object inside the loop body?   
   >   
   > The implementor of the algorithm simply avoids declaring temporary   
   > objects in his loops.  The algorithm implementor is not (or should   
   > not be) subject to your guideline.  In fact, the guideline should   
   > probably be rewritten in the form, "avoid doing XXX, or if you must,   
   > encapsulate it."  That's pretty much the right form for most things   
   > one might want to generally prohibit, like casts.   
      
   What does an algorithm change with regard to the lifetime of   
   temporaries?  Naturally, the functor may declare its own local   
   variable in the scope of the function to be called, or it may try to   
   use a variable that's supplied externally to the functor. In either   
   case, I don't see any fundamental differences from the situations with   
   the manually-written loops.   
      
   --   
   Seungbeom Kim   
      
      
         [ 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