Registry / utility / fruit
library3.7.1vcpkgunverified

Fruit, a dependency injection framework for C++ by Google

vcpkg install fruit
INSTALL
IMPORT
SIG · FRUIT
F
fruit
utilitycppv3.7.1
harness data pending
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.

fruit/fruit.h
#include <fruit/fruit.h>

Basic dependency injection with Fruit

#include <fruit/fruit.h> #include <iostream> struct Greeter { virtual void greet() = 0; }; struct EnglishGreeter : public Greeter { INJECT(EnglishGreeter()) = default; void greet() override { std::cout << "Hello!\n"; } }; fruit::Component<Greeter> getGreeterComponent() { return fruit::createComponent() .bind<Greeter, EnglishGreeter>(); } int main() { fruit::Injector<Greeter> injector(getGreeterComponent); Greeter* greeter = injector.get<Greeter*>(); greeter->greet(); return 0; }
Debug
Known issues
gotchaFruit requires C++14 or later and may have ABI issues across compilers.
fix
Ensure consistent compiler and C++ standard across all translation units.
affects: all
Upgrade
Version history
3.7.1latest on vcpkg
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources

No resource links recorded.

fruit — pip install fruit · libregistry