I have also been waiting for SML! I'd be happy to help and assist review managers! Cem Am So., 21. Feb. 2021 um 00:28 Uhr schrieb Krzysztof Jusiak via Boost < boost@lists.boost.org>:
Great question. There are multiple ways of distinguishing them but IMHO strong types would be the most elegant/encouraged when used with DI.
struct X { name_t name; };
struct Y { title_t title };
auto injector = di::make_injector( bind
.to("name"), bind .to("title") ); Alternatively, named annotations can be used too - https://boost-ext.github.io/di/tutorial.html (search named or annotations)
Or what it's called a context injection
auto injector = di::make_injector( bindstd::string.when<X>.to("name"), bindstd::string.when<Y>.to("title") );
On Sat, Feb 20, 2021 at 9:44 AM Peter Dimov via Boost < boost@lists.boost.org> wrote:
Krzysztof Jusiak wrote:
documentation: https://boost-ext.github.io/di/
This brings up one pretty obvious question, what if I have two constructor parameters of the same type:
struct X { std::string name; };
struct Y { std::string title; };
struct Z { X x; Y y; };
How do I inject specific values for X::name and Y::title?
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost