Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
bext/di.hpp
✓ #include <bext/di.hpp>
Bind an interface to an implementation and resolve it
#include "bext/di.hpp"
#include <iostream>
struct Greeter {
virtual void greet() = 0;
};
struct HelloGreeter : Greeter {
void greet() override { std::cout << "Hello!" << std::endl; }
};
int main() {
auto injector = di::make_injector(
di::bind<Greeter>.to<HelloGreeter>()
);
auto greeter = injector.create<std::unique_ptr<Greeter>>();
greeter->greet();
return 0;
}
Debug
Known issues
No known issues recorded.
Audit
Dependencies
No dependency data recorded yet.
Resources
No resource links recorded.