In this video, the real superpower of C++ is demonstrated. It is in response to some comments on • 1 Problem, 4 C++'s .
constexpr C++ Solution: https://godbolt.org/z/e3j63c3b6
Maximum Prime Difference: https://leetcode.com/problems/maximum...
Chapters:
0:00 Intro
0:46 YouTube Comment on constexpr
1:52 Refactor: std::ranges::contains
2:10 Refactor: namespace stdr
2:59 Show constexpr is_prime
3:57 Original code (~4000 LOA lines of assembly)
4:00 Remove std::println (129 LOA)
4:33 constexpr maximum_prime_difference (129 LOA)
5:03 Remove std::vector (113 LOA)
5:32 Diagnose using consteval
6:14 constexpr vec variable (3 LOA)
7:14 Outro
Follow me on GitHub: https://github.com/codereport
Follow me on Twitter: / code_report
Follow me on LinkedIn: / codereport