phs / sauce Goto Github PK
View Code? Open in Web Editor NEWA C++98 Dependency Injection Framework MOVED TO GITLAB
Home Page: https://gitlab.com/philhsmith/sauce
License: Other
A C++98 Dependency Injection Framework MOVED TO GITLAB
Home Page: https://gitlab.com/philhsmith/sauce
License: Other
OS: WinXP SP3
ToolChain: MinGW32 with GCC 4.4
version of Sauce: master
The test-suite.log
is here
There is no problem with GCC 4.7.
... forcing a new allocation for each function call and for the shared_ptr an increase of the atomic value each time you pass it by value. They should almost all be passed by reference to reduce memory and atomic operations.
Hi phs, first of all I would like to mention that this is great work. Basing your work and providing signature compatibility with guice is a smart choice.
I am having the same issue as #5 (already posted here). The code is failing when it is trying to create implicit provider binding during compile time.
I have issues compiling test code. Got this "helpful" error message (in ansi_compilation_test.cc, line: binder.bind().named().toProvider<CowProvider()>();)
1>c:\dev\git\sauce\sauce\internal\implicit_bindings.h(107): error C2259: 'sauce::internal::ImplicitProviderBinding<ProvidedDependency,Name>' : cannot instantiate abstract class
1> with
1> [
1> ProvidedDependency=Animal
1> , Name=Meatloaf
1> ]
1> due to following members:
1> 'void sauce::internal::Binding<Dependency,Scope>::inject(std::shared_ptrsauce::Provider &,std::shared_ptrsauce::internal::ResolvedBinding,sauce::internal::InjectorPtr) const' : is abstract
1> with
1> [
1> Dependency=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> , Scope=sauce::NoScope
1> ]
1> c:\dev\git\sauce\sauce\internal\binding.h(45) : see declaration of 'sauce::internal::Binding<Dependency,Scope>::inject'
1> with
1> [
1> Dependency=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> , Scope=sauce::NoScope
1> ]
1> c:\dev\git\sauce\sauce\internal\implicit_bindings.h(102) : while compiling class template member function 'std::shared_ptrsauce::internal::ResolvedBinding<Dependency_> sauce::internal::ImplicitBinding::get(const sauce::internal::Concrete &,const std::string)'
1> with
1> [
1> Dependency_=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> , Dependency=Normalized
1> ]
1> c:\dev\git\sauce\sauce\internal\implicit_bindings.h(62) : see reference to function template instantiation 'std::shared_ptrsauce::internal::ResolvedBinding<Dependency_> sauce::internal::ImplicitBinding::get(const sauce::internal::Concrete &,const std::string)' being compiled
1> with
1> [
1> Dependency_=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> , Dependency=Normalized
1> ]
1> c:\dev\git\sauce\sauce\internal\implicit_bindings.h(62) : see reference to class template instantiation 'sauce::internal::ImplicitBinding' being compiled
1> with
1> [
1> Dependency=Normalized
1> ]
1> c:\dev\git\sauce\sauce\internal\bindings.h(87) : see reference to function template instantiation 'std::shared_ptrsauce::internal::ResolvedBinding<Dependency_> sauce::internal::ImplicitBindings::getProviding(const sauce::internal::Concrete &,const std::string) const' being compiled
1> with
1> [
1> Dependency_=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> , Dependency=Normalized
1> ]
1> c:\dev\git\sauce\sauce\internal\bindings.h(119) : see reference to function template instantiation 'std::shared_ptrsauce::internal::ResolvedBinding<Dependency_> sauce::internal::Bindings::getProvidingBinding(const std::string) const' being compiled
1> with
1> [
1> Dependency_=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> , ImplicitBindings=sauce::internal::ImplicitBindings
1> , Dependency=Normalized
1> ]
1> c:\dev\git\sauce\sauce\internal\bindings.h(119) : see reference to function template instantiation 'std::shared_ptrsauce::internal::ResolvedBinding<Dependency_> sauce::internal::Bindings::getProvidingBinding(const std::string) const' being compiled
1> with
1> [
1> Dependency_=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> , ImplicitBindings=sauce::internal::ImplicitBindings
1> , Dependency=Normalized
1> ]
1> c:\dev\git\sauce\sauce\internal\base_injector.h(70) : see reference to function template instantiation 'void sauce::internal::Bindings::validateAcyclic(bool,sauce::internal::Bindings::InjectorPtr,sauce::internal::TypeIds &,const std::string) const' being compiled
1> with
1> [
1> ImplicitBindings=sauce::internal::ImplicitBindings
1> ]
1> c:\dev\git\sauce\sauce\internal\base_injector.h(70) : see reference to function template instantiation 'void sauce::internal::Bindings::validateAcyclic(bool,sauce::internal::Bindings::InjectorPtr,sauce::internal::TypeIds &,const std::string) const' being compiled
1> with
1> [
1> ImplicitBindings=sauce::internal::ImplicitBindings
1> ]
1> c:\dev\git\sauce\sauce\injector.h(67) : see reference to function template instantiation 'void sauce::internal::BaseInjectorsauce::internal::ImplicitBindings::validateAcyclic(bool,sauce::internal::BaseInjectorsauce::internal::ImplicitBindings::InjectorPtr,sauce::internal::TypeIds &,const std::string) const' being compiled
1> with
1> [
1> Dependency=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> ]
1> c:\dev\git\sauce\sauce\injector.h(67) : see reference to function template instantiation 'void sauce::internal::BaseInjectorsauce::internal::ImplicitBindings::validateAcyclic(bool,sauce::internal::BaseInjectorsauce::internal::ImplicitBindings::InjectorPtr,sauce::internal::TypeIds &,const std::string) const' being compiled
1> with
1> [
1> Dependency=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> ]
1> c:\dev\git\sauce\sauce\injector.h(201) : see reference to function template instantiation 'void sauce::Injector::validateAcyclic(bool,sauce::internal::InjectorPtr,sauce::internal::TypeIds &,const std::string)' being compiled
1> with
1> [
1> Dependency=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> ]
1> c:\dev\git\sauce\sauce\internal\provider_binding.h(23) : see reference to function template instantiation 'void sauce::internal::InjectorFriend::validateAcyclicHelper(sauce::internal::InjectorPtr,sauce::internal::TypeIds &,const std::string) const' being compiled
1> with
1> [
1> Provider=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> ]
1> c:\dev\git\sauce\sauce\internal\provider_binding.h(22) : while compiling class template member function 'void sauce::internal::ProviderBinding<ProvidedDependency,Scope,ProviderDependency>::validateAcyclic(sauce::internal::InjectorPtr,sauce::internal::TypeIds &) const'
1> with
1> [
1> Scope=sauce::NoScope
1> , ProviderDependency=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> ]
1> c:\dev\git\sauce\sauce\binder.h(68) : see reference to class template instantiation 'sauce::internal::ProviderBinding<ProvidedDependency,Scope,ProviderDependency>' being compiled
1> with
1> [
1> Scope=sauce::NoScope
1> , ProviderDependency=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> ]
1> c:\dev\git\sauce\sauce\binder.h(59) : while compiling class template member function 'void sauce::ToProviderClausesauce::Named<sauce::Provider<Dependency,Meatloaf>,sauce::NoScope,CowProvider (void)>::onComplete(void)'
1> with
1> [
1> Dependency=Animal
1> ]
1> c:\dev\git\sauce\sauce\testansi.cpp(63) : see reference to class template instantiation 'sauce::ToProviderClausesauce::Named<sauce::Provider<Dependency,Meatloaf>,sauce::NoScope,CowProvider (void)>' being compiled
1> with
1> [
1> Dependency=Animal
1> ]
1>c:\dev\git\sauce\sauce\internal\implicit_bindings.h(107): error C2664: 'sauce::internal::ImplicitProviderBinding<ProvidedDependency,Name>::ImplicitProviderBinding(const sauce::internal::ImplicitProviderBinding<ProvidedDependency,Name> &)' : cannot convert parameter 2 from 'ProvidedBindingPtr' to 'std::shared_ptrsauce::internal::ResolvedBinding<Dependency_>'
1> with
1> [
1> ProvidedDependency=Animal
1> , Name=Meatloaf
1> ]
1> and
1> [
1> Dependency_=sauce::Namedsauce::Provider<Animal,Meatloaf>
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>
1>Build FAILED.
Hello,
I've defined a binding, like this one: bind<Smth>().to<BestSmth(int,int)>()
.
Now, I've created a Modules
and an Injector
, and I want to create an instance of Smth
according to the binding above, how could I do this?
Because:
shared_ptr<Smth> s = an_injector->get<BestSmth>(42, 42);
is an error, get does not takes args for BestSmth
ctor.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.