C++ Weekly - Ep 216 - C++20's lerp, midpoint And Why They Are Necessary

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

Upcoming Workshop: Applied constexpr: The Power of Compile-Time Resources, C++ Under The Sea, October 10, 2024

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

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

Great tips. I'd be willing to bet that arithmetic overflow thing has to be a very common hard to find bug in software today.

DamianReloaded
Автор

Absolutely on par as always Jason!!!

Thanks for this perfectly executed tutorial, always appreciated gaining *C++* insights.

essenceidentity
Автор

Just posting this comment so your content will have more reach. Found it useful, thanks!

woolseyband
Автор

Should have shown what happens in assembly with non-constexpr variables to see how it deals with overflow. But nice explanation anyhow =)

WhoNoMe
Автор

Why lerp is in <cmath> while midpoint is in <numeric>? :/

David-wsrw
Автор

This is absolutely amazing! Can you provide us some exercices about all that?

imcnx
Автор

I feel there is some inconsistency in the order of the arguments between std::lerp(v, low, high) and std::clamp(low, high, v), since it's not the same for the two functions, i am unable to remember which one is in which order and need to open cppreference each time i use it.

alexandrebustico
Автор

I just watched Jonathan Blow rage about the std::lerp implementation last week. If you really feel that the std lerp holds you back don't be afraid to write your own.

loomismeister
Автор

There should have been a midpoint overload for RandomAccessIterators, which would be very useful.

cmdlp
Автор

Is it okay to have two returns? one immediately after another one like here 1:22. There is no warning even with -Wextra.

simonluner
Автор

Why is midpoint for pointers not noexcept? And what happens if you use it with virtual classes?

cmdlp