Re:Lambda expression comparison between C++11, C++14 and C++17
by csl on Sunday May 15, 2016 @05:35AM
(#11700151)
I find that pointlessly pedantic. By the same measure, languages that don't offer bignums don't offer integers. Even Lisps need to implement closures in one way or another, and you may be surprised to see how they actually do it.
[ Parent
| on HN ]
Re:Lambda expression comparison between C++11, C++14 and C++17
by moonshinefe on Sunday May 15, 2016 @05:53AM
(#11700196)
I think you miss the point, the OP was mentioning the property that in most languages, closures whose outer variables they are bringing into scope stay in scope (even if the outer function ends). In C++ they expire (is what I got from his comment, anyway).
Re:Lambda expression comparison between C++11, C++14 and C++17
by gpderetta on Sunday May 15, 2016 @08:06AM
(#11700604)
Closed-by-value variables (I.e. the default) in C++ don't expire. Referenced or pointed-to object might, but this is completely consistent with the rest of the language.
Remember that C++ is a by value language. Pointers are explicit, fist class and distinct from the pointed to object.
References are werid, though.