tools/tests: fix compilation errors caused by bind and placeholders

refs #2175

Change-Id: I65eadb0d0ccf468c3d478236335dbf09aa4dcc71
diff --git a/tests/daemon/mgmt/face-manager.cpp b/tests/daemon/mgmt/face-manager.cpp
index ad798af..aa1bf32 100644
--- a/tests/daemon/mgmt/face-manager.cpp
+++ b/tests/daemon/mgmt/face-manager.cpp
@@ -813,9 +813,9 @@
 {
   shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/faces"));
 
-  getFace()->onReceiveData +=
-    bind(&FaceManagerFixture::validateControlResponse, this,  _1,
-         command->getName(), 400, "Malformed command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   getFace()->sendInterest(*command);
   g_io.run_one();
@@ -827,9 +827,9 @@
 {
   shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/faces"));
 
-  getFace()->onReceiveData +=
-    bind(&FaceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   getManager().onFaceRequest(*command);
 
@@ -849,9 +849,9 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData +=
-    bind(&FaceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 401, "Signature required");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 401, "Signature required");
+  };
 
   getManager().onFaceRequest(*command);
 
@@ -872,9 +872,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&FaceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 403, "Unauthorized command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 403, "Unauthorized command");
+  };
 
   getManager().onFaceRequest(*command);
 
@@ -910,9 +910,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&FaceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 501, "Unsupported command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 501, "Unsupported command");
+  };
 
   getManager().onFaceRequest(*command);
 
@@ -980,9 +980,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&ValidatedFaceRequestFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   onValidatedFaceRequest(command);
 
@@ -1077,8 +1077,10 @@
   generateCommand(*enableCommand);
 
   TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         enableCommand->getName(), 200, "Success", encodedParameters);
+  [this, enableCommand, encodedParameters] (const Data& response) {
+    this->validateControlResponse(response, enableCommand->getName(),
+                                  200, "Success", encodedParameters);
+  };
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1098,8 +1100,10 @@
   generateCommand(*disableCommand);
 
   TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         disableCommand->getName(), 200, "Success", encodedParameters);
+  [this, disableCommand, encodedParameters] (const Data& response) {
+    this->validateControlResponse(response, disableCommand->getName(),
+                                  200, "Success", encodedParameters);
+  };
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1128,9 +1132,9 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         enableCommand->getName(), 410, "Face not found");
+  TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
+    this->validateControlResponse(response, enableCommand->getName(), 410, "Face not found");
+  };
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1149,9 +1153,9 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         disableCommand->getName(), 410, "Face not found");
+  TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
+    this->validateControlResponse(response, disableCommand->getName(), 410, "Face not found");
+  };
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1179,9 +1183,9 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         enableCommand->getName(), 400, "Malformed command");
+  TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
+    this->validateControlResponse(response, enableCommand->getName(), 400, "Malformed command");
+  };
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1200,9 +1204,9 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         disableCommand->getName(), 400, "Malformed command");
+  TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
+    this->validateControlResponse(response, disableCommand->getName(), 400, "Malformed command");
+  };
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1231,9 +1235,9 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         enableCommand->getName(), 412, "Face is non-local");
+  TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
+    this->validateControlResponse(response, enableCommand->getName(), 412, "Face is non-local");
+  };
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1250,9 +1254,9 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         disableCommand->getName(), 412, "Face is non-local");
+  TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
+    this->validateControlResponse(response, disableCommand->getName(), 412, "Face is non-local");
+  };
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1280,8 +1284,10 @@
   generateCommand(*enableCommand);
 
   TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         enableCommand->getName(), 200, "Success", encodedParameters);
+  [this, enableCommand, encodedParameters] (const Data& response) {
+    this->validateControlResponse(response, enableCommand->getName(),
+                                  200, "Success", encodedParameters);
+  };
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1302,8 +1308,10 @@
   generateCommand(*disableCommand);
 
   TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         disableCommand->getName(), 200, "Success", encodedParameters);
+  [this, disableCommand, encodedParameters] (const Data& response) {
+    this->validateControlResponse(response, disableCommand->getName(),
+                                  200, "Success", encodedParameters);
+  };
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1332,9 +1340,9 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         enableCommand->getName(), 410, "Face not found");
+  TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
+    this->validateControlResponse(response, enableCommand->getName(), 410, "Face not found");
+  };
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1354,9 +1362,9 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         disableCommand->getName(), 410, "Face not found");
+  TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
+    this->validateControlResponse(response, disableCommand->getName(), 410, "Face not found");
+  };
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1385,9 +1393,9 @@
 
   generateCommand(*enableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         enableCommand->getName(), 412, "Face is non-local");
+  TestFaceManagerCommon::m_face->onReceiveData += [this, enableCommand] (const Data& response) {
+    this->validateControlResponse(response, enableCommand->getName(), 412, "Face is non-local");
+  };
 
   onValidatedFaceRequest(enableCommand);
 
@@ -1404,9 +1412,9 @@
 
   generateCommand(*disableCommand);
 
-  TestFaceManagerCommon::m_face->onReceiveData +=
-    bind(&LocalControlFixture::validateControlResponse, this, _1,
-         disableCommand->getName(), 412, "Face is non-local");
+  TestFaceManagerCommon::m_face->onReceiveData += [this, disableCommand] (const Data& response) {
+    this->validateControlResponse(response, disableCommand->getName(), 412, "Face is non-local");
+  };
 
   onValidatedFaceRequest(disableCommand);
 
@@ -1522,9 +1530,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&FaceFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   createFace(*command, parameters);
 
@@ -1544,9 +1552,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&FaceFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   createFace(*command, parameters);
 
@@ -1569,9 +1577,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&FaceFixture::validateControlResponse, this, _1,
-         command->getName(), 501, "Unsupported protocol");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 501, "Unsupported protocol");
+  };
 
   createFace(*command, parameters);
 
@@ -1609,9 +1617,10 @@
   Block encodedResultParameters(resultParameters.wireEncode());
 
   getFace()->onReceiveData +=
-    bind(&FaceFixture::callbackDispatch, this, _1,
-         command->getName(), 200, "Success",
-         encodedResultParameters, expectedFaceEvent);
+  [this, command, encodedResultParameters, expectedFaceEvent] (const Data& response) {
+    this->callbackDispatch(response,command->getName(), 200, "Success",
+                           encodedResultParameters, expectedFaceEvent);
+  };
 
   onCreated(command->getName(), parameters, dummy);
 
@@ -1633,9 +1642,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&FaceFixture::validateControlResponse, this, _1,
-         command->getName(), 408, "unit-test-reason");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 408, "unit-test-reason");
+  };
 
   onConnectFailed(command->getName(), "unit-test-reason");
 
@@ -1670,8 +1679,10 @@
                    .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
 
   getFace()->onReceiveData +=
-    bind(&FaceFixture::callbackDispatch, this, _1, command->getName(),
-         200, "Success", ref(encodedParameters), expectedFaceEvent);
+  [this, command, encodedParameters, expectedFaceEvent] (const Data& response) {
+    this->callbackDispatch(response,command->getName(), 200, "Success",
+                           encodedParameters, expectedFaceEvent);
+  };
 
   destroyFace(*command, parameters);
 
diff --git a/tests/daemon/mgmt/fib-manager.cpp b/tests/daemon/mgmt/fib-manager.cpp
index 6f5a006..22bf276 100644
--- a/tests/daemon/mgmt/fib-manager.cpp
+++ b/tests/daemon/mgmt/fib-manager.cpp
@@ -241,9 +241,9 @@
 
   shared_ptr<Interest> command = makeInterest("/localhost/nfd/fib");
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, this,  _1,
-         command->getName(), 400, "Malformed command");
+  face->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   face->sendInterest(*command);
   g_io.run_one();
@@ -259,9 +259,9 @@
 
   Interest command("/localhost/nfd/fib");
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, this, _1,
-         command.getName(), 400, "Malformed command");
+  face->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command.getName(), 400, "Malformed command");
+  };
 
   getFibManager().onFibRequest(command);
 
@@ -286,9 +286,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 501, "Unsupported command");
+  face->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 501, "Unsupported command");
+  };
 
   getFibManager().onFibRequest(*command);
 
@@ -314,10 +314,9 @@
 
   Interest command(commandName);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse,
-         this, _1, command.getName(), 401, "Signature required");
-
+  face->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command.getName(), 401, "Signature required");
+  };
 
   getFibManager().onFibRequest(command);
 
@@ -345,9 +344,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse,
-         this, _1, command->getName(), 403, "Unauthorized command");
+  face->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 403, "Unauthorized command");
+  };
 
   getFibManager().onFibRequest(*command);
 
@@ -368,9 +367,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  face->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   getFibManager().onFibRequest(*command);
 
@@ -397,9 +396,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 410, "Face not found");
+  face->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 410, "Face not found");
+  };
 
   getFibManager().onFibRequest(*command);
 
@@ -437,9 +436,10 @@
     command->setIncomingFaceId(1);
     generateCommand(*command);
 
-    face->onReceiveData +=
-      bind(&FibManagerFixture::validateControlResponse, this, _1,
-           command->getName(), 200, "Success", encodedExpectedParameters);
+    face->onReceiveData += [this, command, encodedExpectedParameters] (const Data& response) {
+      this->validateControlResponse(response, command->getName(),
+                                    200, "Success", encodedExpectedParameters);
+    };
 
     getFibManager().onFibRequest(*command);
 
@@ -472,9 +472,10 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 200, "Success", encodedParameters);
+  face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+    this->validateControlResponse(response, command->getName(),
+                                  200, "Success", encodedParameters);
+  };
 
   getFibManager().onFibRequest(*command);
 
@@ -506,9 +507,10 @@
   resultParameters.setFaceId(1);
   resultParameters.setCost(0);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 200, "Success", resultParameters.wireEncode());
+  face->onReceiveData += [this, command, resultParameters] (const Data& response) {
+    this->validateControlResponse(response, command->getName(),
+                                  200, "Success", resultParameters.wireEncode());
+  };
 
   getFibManager().onFibRequest(*command);
 
@@ -538,9 +540,10 @@
       shared_ptr<Interest> command(make_shared<Interest>(commandName));
       generateCommand(*command);
 
-      face->onReceiveData +=
-        bind(&FibManagerFixture::validateControlResponse, this, _1,
-             command->getName(), 200, "Success", encodedParameters);
+      face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+        this->validateControlResponse(response, command->getName(),
+                                      200, "Success", encodedParameters);
+      };
 
       getFibManager().onFibRequest(*command);
       BOOST_REQUIRE(didCallbackFire());
@@ -586,9 +589,10 @@
     shared_ptr<Interest> command(make_shared<Interest>(commandName));
     generateCommand(*command);
 
-    face->onReceiveData +=
-      bind(&FibManagerFixture::validateControlResponse, this, _1,
-           command->getName(), 200, "Success", encodedParameters);
+    face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+      this->validateControlResponse(response, command->getName(),
+                                    200, "Success", encodedParameters);
+    };
 
     getFibManager().onFibRequest(*command);
 
@@ -610,9 +614,10 @@
     shared_ptr<Interest> command(make_shared<Interest>(commandName));
     generateCommand(*command);
 
-    face->onReceiveData +=
-      bind(&FibManagerFixture::validateControlResponse, this, _1,
-           command->getName(), 200, "Success", encodedParameters);
+    face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+      this->validateControlResponse(response, command->getName(),
+                                    200, "Success", encodedParameters);
+    };
 
     getFibManager().onFibRequest(*command);
 
@@ -656,9 +661,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  face->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   getFibManager().onFibRequest(*command);
 
@@ -700,9 +705,10 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   fixture->generateCommand(*command);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, fixture, _1,
-         command->getName(), 200, "Success", encodedParameters);
+  face->onReceiveData += [fixture, command, encodedParameters] (const Data& response) {
+    fixture->validateControlResponse(response, command->getName(),
+                                     200, "Success", encodedParameters);
+  };
 
   manager.onFibRequest(*command);
 
@@ -761,9 +767,10 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 200, "Success", encodedParameters);
+  face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+    this->validateControlResponse(response, command->getName(),
+                                  200, "Success", encodedParameters);
+  };
 
   getFibManager().onFibRequest(*command);
 
@@ -789,9 +796,10 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 200, "Success", encodedParameters);
+  face->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+    this->validateControlResponse(response, command->getName(),
+                                  200, "Success", encodedParameters);
+  };
 
   getFibManager().onFibRequest(*command);
 
@@ -816,9 +824,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  face->onReceiveData +=
-    bind(&FibManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  face->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   getFibManager().onFibRequest(*command);
 
@@ -851,9 +859,10 @@
     resultParameters.setFaceId(1);
     resultParameters.setName("/hello");
 
-    face->onReceiveData +=
-      bind(&FibManagerFixture::validateControlResponse, this, _1,
-           command->getName(), 200, "Success", resultParameters.wireEncode());
+    face->onReceiveData += [this, command, resultParameters] (const Data& response) {
+      this->validateControlResponse(response, command->getName(),
+                                    200, "Success", resultParameters.wireEncode());
+    };
 
     getFibManager().onFibRequest(*command);
 
diff --git a/tests/daemon/mgmt/manager-base.cpp b/tests/daemon/mgmt/manager-base.cpp
index 5d2b6c3..0aa7077 100644
--- a/tests/daemon/mgmt/manager-base.cpp
+++ b/tests/daemon/mgmt/manager-base.cpp
@@ -166,9 +166,9 @@
   ndn::nfd::ControlParameters parameters;
   parameters.setName("/test/body");
 
-  getInternalFace()->onReceiveData +=
-    bind(&ManagerBaseTest::validateControlResponse, this, _1,
-         "/response", 100, "test", parameters.wireEncode());
+  getInternalFace()->onReceiveData += [this, parameters] (const Data& response) {
+    this->validateControlResponse(response, "/response", 100, "test", parameters.wireEncode());
+  };
 
   testSendResponse("/response", 100, "test", parameters.wireEncode());
   BOOST_REQUIRE(didCallbackFire());
@@ -177,9 +177,9 @@
 
 BOOST_AUTO_TEST_CASE(SendResponse3Arg)
 {
-  getInternalFace()->onReceiveData +=
-    bind(&ManagerBaseTest::validateControlResponse, this, _1,
-         "/response", 100, "test");
+  getInternalFace()->onReceiveData += [this] (const Data& response) {
+    this->validateControlResponse(response, "/response", 100, "test");
+  };
 
   testSendResponse("/response", 100, "test");
   BOOST_REQUIRE(didCallbackFire());
@@ -187,9 +187,9 @@
 
 BOOST_AUTO_TEST_CASE(SendResponse2Arg)
 {
-  getInternalFace()->onReceiveData +=
-    bind(&ManagerBaseTest::validateControlResponse, this, _1,
-         "/response", 100, "test");
+  getInternalFace()->onReceiveData += [this] (const Data& response) {
+    this->validateControlResponse(response, "/response", 100, "test");
+  };
 
   ControlResponse response(100, "test");
 
diff --git a/tests/daemon/mgmt/strategy-choice-manager.cpp b/tests/daemon/mgmt/strategy-choice-manager.cpp
index f8af3bb..2ae23c5 100644
--- a/tests/daemon/mgmt/strategy-choice-manager.cpp
+++ b/tests/daemon/mgmt/strategy-choice-manager.cpp
@@ -225,9 +225,9 @@
 {
   shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/strategy-choice"));
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this,  _1,
-         command->getName(), 400, "Malformed command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   getFace()->sendInterest(*command);
   g_io.run_one();
@@ -239,9 +239,9 @@
 {
   shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/strategy-choice"));
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   getManager().onStrategyChoiceRequest(*command);
 
@@ -262,9 +262,9 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 401, "Signature required");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 401, "Signature required");
+  };
 
   getManager().onStrategyChoiceRequest(*command);
 
@@ -287,9 +287,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 403, "Unauthorized command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 403, "Unauthorized command");
+  };
 
   getManager().onStrategyChoiceRequest(*command);
 
@@ -311,9 +311,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 501, "Unsupported command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 501, "Unsupported command");
+  };
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -329,9 +329,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -352,9 +352,10 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 200, "Success", encodedParameters);
+  getFace()->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+    this->validateControlResponse(response, command->getName(),
+                                  200, "Success", encodedParameters);
+  };
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -377,9 +378,10 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 200, "Success", encodedParameters);
+  getFace()->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+    this->validateControlResponse(response, command->getName(),
+                                  200, "Success", encodedParameters);
+  };
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -406,9 +408,10 @@
   responseParameters.setName("/test");
   responseParameters.setStrategy("/localhost/nfd/strategy/test-strategy-c/%FD%02");
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 200, "Success", responseParameters.wireEncode());
+  getFace()->onReceiveData += [this, command, responseParameters] (const Data& response) {
+    this->validateControlResponse(response, command->getName(),
+                                  200, "Success", responseParameters.wireEncode());
+  };
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -430,9 +433,9 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -452,9 +455,9 @@
 
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -478,9 +481,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 504, "Unsupported strategy");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 504, "Unsupported strategy");
+  };
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -552,9 +555,10 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 200, "Success", encodedParameters);
+  getFace()->onReceiveData += [this, command, encodedParameters] (const Data& response) {
+    this->validateControlResponse(response, command->getName(),
+                                  200, "Success", encodedParameters);
+  };
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -578,9 +582,10 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 403, "Cannot unset root prefix strategy");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(),
+                                  403, "Cannot unset root prefix strategy");
+  };
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
@@ -607,9 +612,9 @@
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
   generateCommand(*command);
 
-  getFace()->onReceiveData +=
-    bind(&StrategyChoiceManagerFixture::validateControlResponse, this, _1,
-         command->getName(), 400, "Malformed command");
+  getFace()->onReceiveData += [this, command] (const Data& response) {
+    this->validateControlResponse(response, command->getName(), 400, "Malformed command");
+  };
 
   getManager().onValidatedStrategyChoiceRequest(command);
 
diff --git a/tools/ndn-tlv-peek.cpp b/tools/ndn-tlv-peek.cpp
index dca57e0..5460096 100644
--- a/tools/ndn-tlv-peek.cpp
+++ b/tools/ndn-tlv-peek.cpp
@@ -33,9 +33,6 @@
 
 namespace ndntlvpeek {
 
-using ndn::_1;
-using ndn::_2;
-
 class NdnTlvPeek : boost::noncopyable
 {
 public:
diff --git a/tools/ndn-tlv-poke.cpp b/tools/ndn-tlv-poke.cpp
index 31ec561..45db702 100644
--- a/tools/ndn-tlv-poke.cpp
+++ b/tools/ndn-tlv-poke.cpp
@@ -34,9 +34,6 @@
 
 namespace ndntlvpoke {
 
-using ndn::_1;
-using ndn::_2;
-
 class NdnTlvPoke : boost::noncopyable
 {
 public:
diff --git a/tools/nfdc.cpp b/tools/nfdc.cpp
index bfae684..2ecba4d 100644
--- a/tools/nfdc.cpp
+++ b/tools/nfdc.cpp
@@ -70,9 +70,7 @@
 
 namespace nfdc {
 
-using ndn::bind;
-using ndn::_1;
-using ndn::_2;
+using std::bind;
 
 const ndn::time::milliseconds Nfdc::DEFAULT_EXPIRATION_PERIOD = ndn::time::milliseconds::max();
 const uint64_t Nfdc::DEFAULT_COST = 0;