C++ Weekly - Ep 89 - Overusing Lambdas

preview_player
Показать описание
☟☟ Awesome T-Shirts! Sponsors! Books! ☟☟

T-SHIRTS AVAILABLE!

WANT MORE JASON?

SUPPORT THE CHANNEL

GET INVOLVED

JASON'S BOOKS

► C++23 Best Practices

► C++ Best Practices

JASON'S PUZZLE BOOKS

► Object Lifetime Puzzlers Book 1

► Object Lifetime Puzzlers Book 2

► Object Lifetime Puzzlers Book 3

► Copy and Reference Puzzlers Book 1

► Copy and Reference Puzzlers Book 2

► Copy and Reference Puzzlers Book 3

► OpCode Puzzlers Book 1


RECOMMENDED BOOKS

AWESOME PROJECTS

O'Reilly VIDEOS

Source:
Рекомендации по теме
Комментарии
Автор

When you cut into 0:30 I let out a cry of fear. Bro, what the fuck?? I gotta learn to code like this now.

ollicron
Автор

Just a comment on this:
A lambda is an actual function, and I personally don't see the point if it is an argument in chunk of code in, say, 10 places and identical (and supposed to be identical). If that is inlined, that is 10 lots of code. Why not have a class functor, the guts of which are defined separately, and call that from the 10 places? Surely this will not be inline and the total code object size will be smaller. You pay the price of an actual call (non-inline).That can hardly break the bank.

Really I would like to see an article of all the pluses and minuses of free functions, member functions, lambdas & functors : All that you can do and not do. The downsides - code size, inlineability, which is faster, smaller etc. On the basis of that, programmers can decide what they really need in a given situation. Functors are dead useful when you need to pass additional arguments to a predicates (for algorithms), the class being able to carry member data which is used in operator ().

Lambdas can have closure and that is a an important property from functional programming. What about immutability?

stephenhowe
Автор

Does this make any difference if you strip?

reductor_
Автор

Hey, great channel. What editor do you use?

adriangrzemski
Автор

What shell do you use? It looks very interesting

philipstuckey
Автор

I haven't written a single lambda. Am I overusing it?

stephenhowe