r/cpp • u/Acrobatic-Stable2537 n0F4x • Jun 25 '26
C++23 Dependency Injection library with automatic dependency building
I open-sourced my dependency injection library.
Link: https://github.com/n0F4x/redi
This was developed for my game engine.
- feature-rich dependency configuration
- optimized for fast compile time
- helpful error messages when a cyclic dependency is detected
- dependencies are automatically constructed - no need to register them by hand
I am giving this project to the community so that everybody can benefit. This kind of approach is mostly useful when dealing with intricate systems, such as a plugin system. I welcome all kinds of feedback, as this was mostly a learning opportunity for me. If you'd like to use this in your project but don't have access to the required compiler features, let me know, and I'll see if I can reduce the requirements.
View all comments
Show parent comment
1
u/gracicot Jun 26 '26
Probably heavier on the compile times. Your library looks much simpler than mine, mainly because it focuses on one case to solve as opposed to mine which tries to be as extensive as possible. Also I like how you create the graph locally as opposed to globally like I'm doing.
It seems you detect cycles? Unless I let the compiler hard stop on circular concepts, I can't seem to detect such case. How do you do that?