common: stop importing std::{bind,ref,cref} into namespace ndn

And reduce the usage of std::bind() throughout the codebase.
C++14 lambdas are easier to understand for humans and more
likely to be optimized by the compiler.

Change-Id: Ia59fad34539710f8801c52914896ce426fb7e538
diff --git a/tests/unit/util/notification-subscriber.t.cpp b/tests/unit/util/notification-subscriber.t.cpp
index d8f9dfd..3936e9e 100644
--- a/tests/unit/util/notification-subscriber.t.cpp
+++ b/tests/unit/util/notification-subscriber.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020 Regents of the University of California,
+ * Copyright (c) 2014-2021 Regents of the University of California,
  *                         Arizona Board of Regents,
  *                         Colorado State University,
  *                         University Pierre & Marie Curie, Sorbonne University,
@@ -74,45 +74,16 @@
   void
   deliverNack(const Interest& interest, const lp::NackReason& reason)
   {
-    lp::Nack nack = makeNack(interest, reason);
-    subscriberFace.receive(nack);
-  }
-
-  void
-  afterNotification(const SimpleNotification& notification)
-  {
-    lastNotification = notification;
-  }
-
-  void
-  afterNack(const lp::Nack& nack)
-  {
-    lastNack = nack;
-  }
-
-  void
-  afterTimeout()
-  {
-    hasTimeout = true;
-  }
-
-  void
-  afterDecodeError(const Data& data)
-  {
-    lastDecodeErrorData = data;
+    subscriberFace.receive(makeNack(interest, reason));
   }
 
   void
   connectHandlers()
   {
-    notificationConn = subscriber.onNotification.connect(
-      bind(&NotificationSubscriberFixture::afterNotification, this, _1));
-    nackConn = subscriber.onNack.connect(
-      bind(&NotificationSubscriberFixture::afterNack, this, _1));
-    subscriber.onTimeout.connect(
-      bind(&NotificationSubscriberFixture::afterTimeout, this));
-    subscriber.onDecodeError.connect(
-      bind(&NotificationSubscriberFixture::afterDecodeError, this, _1));
+    notificationConn = subscriber.onNotification.connect([this] (const auto& n) { lastNotification = n; });
+    nackConn = subscriber.onNack.connect([this] (const auto& nack) { lastNack = nack; });
+    subscriber.onTimeout.connect([this] { hasTimeout = true; });
+    subscriber.onDecodeError.connect([this] (const auto& data) { lastDecodeErrorData = data; });
   }
 
   void
diff --git a/tests/unit/util/scheduler.t.cpp b/tests/unit/util/scheduler.t.cpp
index 12f018a..1040b92 100644
--- a/tests/unit/util/scheduler.t.cpp
+++ b/tests/unit/util/scheduler.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -109,7 +109,7 @@
   void
   reschedule()
   {
-    EventId eventId = scheduler.schedule(100_ms, bind(&SelfRescheduleFixture::reschedule, this));
+    EventId eventId = scheduler.schedule(100_ms, [this] { reschedule(); });
     selfEventId.cancel();
     selfEventId = eventId;
 
@@ -125,7 +125,7 @@
     selfEventId.cancel();
 
     if (count < 5)  {
-      selfEventId = scheduler.schedule(100_ms, bind(&SelfRescheduleFixture::reschedule2, this));
+      selfEventId = scheduler.schedule(100_ms, [this] { reschedule2(); });
       count++;
     }
   }
@@ -150,21 +150,21 @@
 
 BOOST_FIXTURE_TEST_CASE(Reschedule, SelfRescheduleFixture)
 {
-  selfEventId = scheduler.schedule(0_s, bind(&SelfRescheduleFixture::reschedule, this));
+  selfEventId = scheduler.schedule(0_s, [this] { reschedule(); });
   BOOST_REQUIRE_NO_THROW(advanceClocks(50_ms, 1000_ms));
   BOOST_CHECK_EQUAL(count, 5);
 }
 
 BOOST_FIXTURE_TEST_CASE(Reschedule2, SelfRescheduleFixture)
 {
-  selfEventId = scheduler.schedule(0_s, bind(&SelfRescheduleFixture::reschedule2, this));
+  selfEventId = scheduler.schedule(0_s, [this] { reschedule2(); });
   BOOST_REQUIRE_NO_THROW(advanceClocks(50_ms, 1000_ms));
   BOOST_CHECK_EQUAL(count, 5);
 }
 
 BOOST_FIXTURE_TEST_CASE(Reschedule3, SelfRescheduleFixture)
 {
-  selfEventId = scheduler.schedule(0_s, bind(&SelfRescheduleFixture::reschedule3, this));
+  selfEventId = scheduler.schedule(0_s, [this] { reschedule3(); });
   BOOST_REQUIRE_NO_THROW(advanceClocks(50_ms, 1000_ms));
   BOOST_CHECK_EQUAL(count, 6);
 }
diff --git a/tests/unit/util/segment-fetcher.t.cpp b/tests/unit/util/segment-fetcher.t.cpp
index c58c1f9..55247fe 100644
--- a/tests/unit/util/segment-fetcher.t.cpp
+++ b/tests/unit/util/segment-fetcher.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -36,6 +36,7 @@
 namespace tests {
 
 using namespace ndn::tests;
+using std::bind;
 
 class SegmentFetcherFixture : public IoKeyChainFixture
 {