Comments (3)
Hi, what are you trying to do?
With that code, I think an error is expected behaviour (bind's purpose is
to bind a base class to a derived class). I suspect that you might achieve
what you want by simply removing the two bind calls altogether, since there
are no base-derived class relationships that you want Fruit to know about.
Does removing the two binds make your modified example code work as
expected? I'm not sure exactly what other changes you did to the example
code so it's hard for me to tell for sure.
The only possible improvement I can see here is having a more specific
error for this case, suggesting to remove the bind call altogether when the
base and derived types are the same.
On 12 Jan 2016 9:31 a.m., "lutts" [email protected] wrote:
current implementation will give SelfLoopError with the following
modified HelloWorld exampleComponent getGreeterComponent() {
return fruit::createComponent()
bind<StdoutWriter, StdoutWriter>()
bind<GreeterImpl, GreeterImpl>();
}—
Reply to this email directly or view it on GitHub
#10.
from fruit.
Thank you. It works without the two binds. I think I must have a bind for every arguments of the constructor. Sorry to disturb you.
from fruit.
I've now improved the error message for this case (in master, will be part of Fruit 1.1.0), to help other people in the same situation.
from fruit.
Related Issues (20)
- Inject class that constructor with parameter 'vector<Writer*>' HOT 1
- Using multibinding HOT 1
- build with vcpkg for ARM64:Android is getting errors HOT 3
- Trying to compile with NDK R22 fails HOT 11
- [Docs] Possible outdated documentation HOT 1
- Fruit does not build in Visual Studio Versions 2019, 2022 or 2022 Preview with CMake HOT 8
- what should I do to use a string as an annotion of some bind? HOT 3
- VS2022 Just My Code for Fruit Library fails using CMAKE HOT 6
- Create a fruit::Component by iterating over a list of fruit::Components HOT 7
- Can fruit be used with C language? HOT 2
- Handling lifetimes HOT 6
- Providing non-injected arguments to DI Objects HOT 14
- Build fails with Visual Studio 2022 with C++20 HOT 8
- Fruit with QT HOT 4
- Factories with reference types broken in fruit 3.7.0
- Generic binding? HOT 2
- Defining Factory Functions for Objects with Multiple Constructors HOT 11
- Replace boost HOT 1
- Creating Collections of DI Objects HOT 3
- [Suggestion] ExtractFirstError meta function SHOULD be non-error safe HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fruit.