⚡ Build the skills to land top-paying quant jobs. Offer ends in 23d 14h 03m 11s23 days 14 hours 3 minutes 11 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 23d 14h 03m 11s23 days 14 hours 3 minutes 11 seconds.

Sign in to watch this lesson
Templates and Generic Programming · 3:55
What can the compiler do for us before the program runs? We watch a constexpr function get evaluated during the build, let if constexpr throw away the branch a type can't use, ask type traits questions about types, and use one to choose memcpy or an element loop, measuring the real difference on a Mac with and without optimisation. We finish with static_assert and C++20's constinit, which make the compiler check our assumptions.