I am trying to understand this code snippet.
stream->set_result(cisco::efm_sdk::UniqueActionResultPtr{
new cisco::efm_sdk::ActionValuesResult{cisco::efm_sdk::ActionValuesResult(cisco::efm_sdk::ActionError)
.add_value(false)
.add_value("Could not set value")}});
Found in:
I understand that one object is instantiated using new cisco::efm_sdk::ActionValuesResult so that the object will survive outside of the scope of the lambda in which it is created. Or at least I believe that is why its being done.
But What I don't understand is why its being passed in an instance of itself when the docs don't specify that it has a constructor that can take such a parameter.
I would think that having the line like this:
stream->set_result(cisco::efm_sdk::UniqueActionResultPtr{
new cisco::efm_sdk::ActionValuesResult(cisco::efm_sdk::ActionError)
.add_value(false)
.add_value("Could not set value")});
Would actually make more sense. I've included a screen shot of the docs. And they are located here online:
Thanks in Advance, and my apologies if I am missing something basic.
-Robert Baindourov

Aucun commentaire:
Enregistrer un commentaire