c5daf87f   
   From: dave@boostpro.com   
      
   on Mon May 07 2012, nroberts wrote:   
      
   > Stepping through a binder invocation is actually fairly annoying. The   
   > argument list calculation stuff takes quite a few calls. On the other   
   > hand, stepping through a lambda is much clearer and resembles more   
   > standard function call debugging. With that in mind it seems that one   
   > should prefer lambda expressions over bind expressions pretty much   
   > whenever both can be used.   
   >   
   > It seems to me that lambda can do everything that bind can do and so   
   > if you follow that rule you'd never use bind at all. Yet both were   
   > included in the standard...   
   >   
   > So is there anything that bind does better than lambda or anything   
   > that bind can do that lambda cannot?   
      
   bind-ish things can do compile-time polymorphism:   
      
    struct FunctionObject   
    {   
    template    
    void operator()(T, U) { .... }   
    }   
      
    std::bind(FunctionObject(), _1, 42)("foo")   
    ==> returns FunctionObject()("foo", 42)   
      
   lambdas require you to specify the parameter types.   
      
   --   
   Dave Abrahams   
   BoostPro Computing   
   http://www.boostpro.com   
      
      
    [ 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)   
|