Overengineering max(a, b) Mixed Comparison Functions, Common References & Rust Lifetime Annotations
Description:
Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Grab it
Explore an in-depth conference talk from C++ on Sea 2024 where Jonathan Müller, a Software Engineer at think-cell, delves into the complexities of implementing a seemingly simple max() function. Learn how to handle mixed comparison functions, understand common references, and implement Rust-style lifetime annotations using template metaprogramming and macros. Discover the nuances of making max() fully generic, addressing challenges like comparing signed and unsigned numbers (max(-1, 1u)) and different value categories (max(lvalue, prvalue)). Follow along as the speaker demonstrates advanced C++ techniques, discusses language semantics, and presents a sophisticated implementation that bridges C++ and Rust concepts. While the resulting solution may be considered overengineered, gain valuable insights into template metaprogramming, macro usage, and modern C++ design patterns that can be applied to real-world programming challenges.
Overengineering max(a, b) - Mixed Comparison Functions, Common References and Rust Lifetime Annotations