As expected, the constructor for Example receives NamedValue param.value == 42
Actual Behavior
When working with a runtime_injector I would expect that the same setup produce the same results
However, it seems that it is not possible to register a value object like this without setting it to a singleton scope, ie. the instance scope does not work. When it is resolved the instance registered is ignored, and a new instance is created with the int resolved from the other binding
Only after registering explicitly as a singleton, resolving a singleton and setting it after the runtime_injector has had the bindings installed will the correct value be passed to the Example constructor
Setup
Testing a strong typedef parameter with the following two classes
Expected Behavior
When using a static injector a strong typedef parameter is captured and delivered to constructors
As expected, the constructor for
Example
receivesNamedValue param.value == 42
Actual Behavior
When working with a
runtime_injector
I would expect that the same setup produce the same resultsHowever, it seems that it is not possible to register a value object like this without setting it to a singleton scope, ie. the instance scope does not work. When it is resolved the instance registered is ignored, and a new instance is created with the
int
resolved from the other bindingOnly after registering explicitly as a singleton, resolving a singleton and setting it after the
runtime_injector
has had the bindings installed will the correct value be passed to theExample
constructorSteps to Reproduce the Problem
Complete sample:
Specifications