News for hackers. Stuff that matters.
Re:Lambda expression comparison between C++11, C++14 and C++17 by leni536 on Sunday May 15, 2016 @04:00AM (#11699985)
I'm not familiar with closures from other languages. What about capturing a shared_ptr by value?
Re:Lambda expression comparison between C++11, C++14 and C++17 by thrownaway2424 on Sunday May 15, 2016 @11:38AM (#11701293)
The thing to keep in mind is that copying a shared_ptr isn't cheap at all. It's a class with a pointer and atomic reference count inside and the atomic inc/dec takes many cycles.
Re:Lambda expression comparison between C++11, C++14 and C++17 by leni536 on Sunday May 15, 2016 @01:47PM (#11701893)
How does this compare to the cost of a closure in other languages? Yeah atomic reference counts are not cheap, but basically that's the point of a shared_ptr.
Re:Lambda expression comparison between C++11, C++14 and C++17 by thrownaway2424 on Sunday May 15, 2016 @05:27PM (#11702856)
I'm not sure. I don't program in C++ because I want it to have performance comparable to other languages.