I've submitted this: https://gerrit.iotivity.org/gerrit/2087 for review which should fix the 'out' param issue.
I'm not convinced that an 'out' param is the correct way to go, but that can be flushed out in the review. I'm 'pro' this commit anyway, since it will result in a reduced amount of copies being made by the C++ stack. -Erich On Mon, 2015-08-03 at 18:17 +0000, Keane, Erich wrote: > I've created a simple reproduction on my box. It seems that > checked_guard isn't causing the problem directly. It calls nil_guard, > which uses std::bind. > > I'm going to see if I can replace the std::bind call with one that > captures appropriately. > > -Erich > > On Mon, 2015-08-03 at 22:36 +0530, ak.ashwini1981 wrote: > > out parameter are due to the underlying C-API. > > > > the checked-guard mainly checks tge nullptr params... which i am > > taking care of otherwise.. > > > > checked-guard takes in rvalue reference.. and forwards that. this > > created the doubt. > > > > i will share the code snippet here.. > > > > thanks. > > Ashwini > > > > On "Keane, Erich" <erich.keane at intel.com>, 3 Aug 2015 22:02 wrote: > > We'd prefer to keep the checked-guard, since its purpose is to > > ensure > > that all errors are consistently thrown throughout the > > process. > > > > We tend to avoid out-parameters so far in the C++ stack due to > > the > > inherent concerns with it, but if it is the only way to do it, > > I'd wish > > to see as soon as possible to make sure it is necessary. > > > > As far as std::forward, my understanding is that it should > > maintain the > > reference-ness of the parameters, so we could potentially have > > an issue. > > > > Got a sample that you could share? If I get time I could take > > a look. > > > > -Erich > > > > > > On Mon, 2015-08-03 at 21:58 +0530, ak.ashwini1981 wrote: > > > > > > > > > Hi Erich, List, > > > > > > > > > > > > I am working on the Provisioning Manager apis from C++ > > space. > > > > > > > > > > > > Intention is to have an out parameter in the function. The > > parameter > > > is a vector. I am passing this by reference. Pushing objects > > to vector > > > are not reflecting at the calling point. > > > > > > > > > > > > On debugging found that the reference pointers are > > different at two > > > sides of the checked_guard() function. > > > > > > Guess the std::forward is doing the trick here. > > > > > > > > > > > > Can I do without the checked_guard() and do the required > > param > > > validation and call the InProcClientWrapper function. > > > > > > > > > > > > Share your inputs. > > > > > > > > > > > > Thanks, > > > > > > Ashwini > > > > > > > > _______________________________________________ > iotivity-dev mailing list > iotivity-dev at lists.iotivity.org > https://lists.iotivity.org/mailman/listinfo/iotivity-dev
