boost-ext / di

C++14 Dependency Injection Library
https://boost-ext.github.io/di
1.17k stars 140 forks source link

Support for decorator pattern #252

Closed ColinDuquesnoy closed 6 years ago

ColinDuquesnoy commented 6 years ago

What is the proper way to use boost-di with the decorator pattern?

How to actually tell boost-di how to map several implementations to the same interface without each decorator to know about the next decorator and how to specify the decorator order? Is there something like when_injected_into<T>?

kanstantsin-chernik commented 6 years ago

@ColinDuquesnoy Hi. I don't think Boost DI has anything ready to use. But probably annotations or factory extension can help you. In any case you can have factory like shared_factory extension and build you decorator there manually.

ColinDuquesnoy commented 6 years ago

Thank you. A factory like shared_factory was exactly what I needed.