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 31,833 of 33,346    |
|    Dave Harris to Michael Kilburn    |
|    Re: What will keep C++ going, given that    |
|    23 Jan 12 17:39:31    |
      a9397b74       From: brangdon@cix.co.uk              crusader.mike@gmail.com (Michael Kilburn) wrote (abridged):       > On Jan 21, 8:24 am, brang...@cix.co.uk (Dave Harris) wrote:       >> For_each is less like:       >> for (auto i = c.begin(); i != c.end(); ++i)       >> body( *i );       >>       >> and more like:       >> for (auto i = c.begin(), e = c.end(); i != e; ++i)       >> body( *i );       >>       >> The latter being so easy to write, and only slightly more       >> verbose, I don't think for_each has a big advantage here.       >       > You can't say that without knowing how complex end() function is.              With the second loop, it doesn't matter how complex end() is, because it       is only evaluated once (and cached in 'e'). That's the same as with       for_each, so I don't see how for_each has a big advantage in this       respect.              -- Dave Harris, Nottingham, UK.                     --        [ 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