Memory safety has become a central concern in modern programming. While Rust’s borrow checker enforces strong safety guarantees at compile time, C++ developers need not remain on the sidelines. This talk explores how the core principles behind borrow checking can be adapted to C++ and enforced entirely at compile time.
We begin by examining what the borrow checker actually does, reviewing Rust’s MIR-based analyses such as Non-Lexical Lifetimes (NLL) and Polonius, along with their limitations. We then show how stateful template metaprogramming can be used to build an intermediate representation of program behavior and enforce borrowing rules during compilation. Finally, we look beyond borrow checking, showing how the framework generalizes beyond borrow checking and how C++26 reflection simplifies and strengthens the implementation. Attendees will gain a practical understanding of borrow checking, stateful metaprogramming, and how modern C++ can move toward stronger compile-time safety guarantees.
Alon is a Senior Software Engineer at Medtronic specializing in 3D and computer graphics with a passion for high performance. He has developed many custom simulation and rendering engines for different platforms using modern C++. He also writes a C++ technical blog and participates in game jams.