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,673 of 33,346    |
|    Cassio Neri to All    |
|    Re: lambda objects not assignable    |
|    22 Nov 12 11:25:40    |
   
   From: cassio.neri@googlemail.com   
      
   > > Actually, one can create different objects of the same closure type.   
   > > Consider:   
   > > auto f = [i]() mutable { return i++;};   
   > > auto g = f;   
   >   
   > It creates a copy of the same closure type, calling copy   
   > constructor, it doesn't need assignment. Lambdas are copiable and   
   > movable, I think it's sufficent, I don't see where assignment can be   
   > practical.   
      
   Sorry if I wasn't clear. I didn't meant neither that 'auto g = f;' is   
   an assignment not that lambdas should support assignment (I don't have   
   an opinion on that).   
      
   Since the topic is about assignment, I should have written 'auto   
   g(f);' to avoid the misunderstanding.   
      
   All I wanted was to give an example showing that it's possible to have   
   two distinct objects (objects with different addresses) of the same   
   closure type.   
      
   Thanks,   
   Cassio.   
      
      
   --   
    [ 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