Boost logo

Boost :

From: Cem Bassoy (cem.bassoy_at_[hidden])
Date: 2021-02-23 07:36:35


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_at_[hidden]>:

> 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<name_t>.to("name"),
> bind<title_t>.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(
> bind<std::string>.when<X>.to("name"),
> bind<std::string>.when<Y>.to("title")
> );
>
> On Sat, Feb 20, 2021 at 9:44 AM Peter Dimov via Boost <
> boost_at_[hidden]>
> 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
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk