Myth: Lambda expressions can cause heap allocations. I see this myth coming up a lot. People think that lambdas can cause a heap allocation – on Reddit, on StackOverflow, on Channel9 comments, in personal conversations. I don’t blame people for thinking this – C++ is complex. But it always seems to be some vague notion… Continue reading Another myth, about C++ lambdas
Month: March 2015
A persistent myth about STL’s remove (and friends)
There seems to be a persistent myth about STL’s remove, remove_if, etc. Ask even a relatively experienced C++ programmer to explain this code. vector v = { 1,2,3,4,5 }; v.erase(remove_if(v.begin(), v.end(), [] (int i) { return (i & 1) == 0; }), v.end()); They’ll recognize the erase-remove idiom and correctly say that it’s removing even… Continue reading A persistent myth about STL’s remove (and friends)
How many bugs are left? The Lincoln Index
You’re working on some software, and you have some QA folks testing it. How do you know how many bugs are left? You know the bugs that the testers find, but how can you estimate the number that aren’t yet found? If your testers work independently, and if your feature is not under continuous development… Continue reading How many bugs are left? The Lincoln Index