On 03/08/2016 06:50 PM, Thiago Macieira wrote:
> 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/

It solves my problem. Thanks.

> 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.
>
>
>


Reply via email to