Exploring Dependency Injection and Reflection in Modern C++
summary
Shows concrete techniques to inject and introspect dependencies in C++20: implements any_settings type erasure to mix template and inheritance, uses boost::pfr field introspection and function traits to extract member count and types at compile time, and demonstrates a working coroutines-based module pattern that yields a setup function whose local objects persist across suspend/resume. Presents tradeoffs (templates increase compile times, linking/global approaches break tests) and a small working prototype that composes components and resolves init order at compile time.
AI-written summary · about
chapters (12)
- 0:00Introduction and agenda
- 1:34Dependency injection basics
- 4:33DI techniques: inheritance and templates
- 9:44DI techniques: linking and type erasure
- 12:48Deep dive into type erasure
- 20:24Global API injection
- 25:35Architectural patterns for DI
- 30:27Implementing component architecture
- 34:40Reflection techniques in C++
- 44:03Advanced reflection with Boost.PFR
- 47:26Combining DI and reflection
- 52:41DI, reflection, and coroutines
related talks
01h 01mReflection
36mCompile-time reflection, Serialization and ORM
01h 10mReflection Is Good for C++ Code Health
47mReflection Techniques in C++
56m“Modern C++ Interfaces..."
01h 08mReflections: Compile-time Introspection of Source Code
06mReflecting Types in C++17/20
01h 27mC++ Reflection - Back on Track
