On ter?a-feira, 8 de mar?o de 2016 22:30:37 PST Philippe Coval wrote: > On Tue, Mar 8, 2016 at 10:03 PM, Otavio Pontes <otavio.pontes at intel.com> > wrote: > > I am seeing the following error when building iotivity using 1.1-rel > > branch: > > > > service/scene-manager/src/Scene.cpp: In member function > > 'std::vector<std::shared_ptr<OIC::Service::SceneAction> > > > OIC::Service::Scene::getSceneActions() const': > > service/scene-manager/src/Scene.cpp:122:29: error: capture of non-variable > > 'OIC::Service::Scene::m_name' > > [&actions, &m_name](const SceneMemberResource::Ptr& > > member) > > ^
> Yes I observed this too and pushed fixes but they're not yet merged : > > https://gerrit.iotivity.org/gerrit/#/c/5497/ The commit should explain why this solves and why the current code is bad. Looking up the C++ standard, it says that "An entity that is designated by a simple-capture [...] shall be this or a variable with automatic storage duration". That means you cannot capture non-static members by name and you have to capture the whole object. Using [&] like you did in your code accomplishes capturing of "this". If you could update the commit message to explain that fact, it would help. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
