Fixed build issue by implicitly capture by reference (of Scene)
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Mon, 7 Mar 2016 10:58:19 +0000 (11:58 +0100)
committerHabib Virji <habib.virji@samsung.com>
Wed, 9 Mar 2016 15:57:05 +0000 (15:57 +0000)
Problem was observed while building on Tizen:2.4:Mobile (g++ 4.9.2):

    error: capture of non-variable 'OIC::Service::Scene::m_name'
    [&actions, &m_name](const SceneMemberResource::Ptr& member)

Futher explanation from Thiago Macieira <thiago.macieira@intel.com> :

  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 [&] accomplishes capturing of "this".

Change-Id: Id9db9ca55b858b5c39cee48a5eb9b25ad9e59b41
Origin: https://github.com/TizenTeam/iotivity/tree/sandbox/pcoval/for-upstream
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/5497
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Habib Virji <habib.virji@samsung.com>
service/scene-manager/src/Scene.cpp

index 3948f88290c475af492f30343265e907f755a251..ec364cd07f36c82d4f298fadee9c991bf7258765 100755 (executable)
@@ -119,7 +119,7 @@ namespace OIC
             auto sceneMemberRes = m_sceneCollectionResource->findSceneMembers(m_name);
 
             std::for_each(sceneMemberRes.begin(), sceneMemberRes.end(),
-                [&actions, &m_name](const SceneMemberResource::Ptr& member)
+                [&](const SceneMemberResource::Ptr& member)
                 {
                     RCSResourceAttributes actionParam;