1

In order to use Boost.Signals2 with Hypodermic, how would I go about connecting the slots? Would I place the connection code within the OnActivating block?

Am I right in thinking they are not duplicating each others functionality even though Hypodermic is built with Signals2?

eigen_enthused
  • 525
  • 6
  • 17

1 Answers1

2

Connecting the signal(s) in OnActivating will not "fire" the signal; that is, your signal's delegates won't be invoked.

But of course, you can do something like this to make it work:

mySignal.connect([](std::shared_ptr< Foo > foo)
{
    // do some stuff with Foo being activated
}); 

builder.autowireType< Foo >()->onActivating(
    [&mySignal](IActivatingData< Foo >& data)
    {
        // invoke all delegates...
        mySignal(data.instance());
    }
);

Hope that helps.

mister why
  • 1,967
  • 11
  • 33