
Hi Sohail,
Definitely interested and will send more comments and questions in a few days Thank you for the interest in the library and looking forward for your comments and questions.
Immediately though: is it possible to separately compile modules and/or the configuration? Yea, it is possible, IMHO the easiest way will be to take advantage of type erasure here, but Pimpl idiom might be - with a bit of effort - achieved as well. So, let's say we want to create application - app - using DI and configuration specified in module - cpp file.
You linked to my library and one of the insights you have made in yours is
###app.hpp
class app {
public:
app(std::shared_ptr<ilogic>, std::shared_ptr<ilogger>);
int run();
private:
std::shared_ptr<ilogic> logic_;
std::shared_ptr<ilogger> logger_;
};
To achieve that with type erasure we are going to declare dynamic_injector
which will be able to create app for us.
###dynamic_injector.hpp
template<typename T>
class dynamic_injector {
public:
template<typename TInjector>
dynamic_injector(const TInjector& injector)
: injector_(new TInjector(injector))
, f_([&]{ return static_cast
(yuck). So good job on that. Thank you, that was one of my main goals whilst designing the library - "Prefer compile- and link-time errors to run-time errors".
Kris -- View this message in context: http://boost.2283326.n4.nabble.com/Is-there-any-interest-in-a-dependency-inj... Sent from the Boost - Dev mailing list archive at Nabble.com.