Reduce usage of std::bind()
C++14 lambdas are easier to read, easier to debug,
and can usually be better optimized by the compiler.
Change-Id: I294f275904f91942a8de946fe63e77078a7608a6
diff --git a/tests/daemon/face/internal-face.t.cpp b/tests/daemon/face/internal-face.t.cpp
index db72bcc..1f2b82a 100644
--- a/tests/daemon/face/internal-face.t.cpp
+++ b/tests/daemon/face/internal-face.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,
@@ -87,9 +87,9 @@
bool hasTimeout = false;
clientFace->expressInterest(*interest,
- bind([] { BOOST_ERROR("unexpected Data"); }),
- bind([] { BOOST_ERROR("unexpected Nack"); }),
- bind([&hasTimeout] { hasTimeout = true; }));
+ [] (auto&&...) { BOOST_ERROR("unexpected Data"); },
+ [] (auto&&...) { BOOST_ERROR("unexpected Nack"); },
+ [&] (auto&&...) { hasTimeout = true; });
this->advanceClocks(1_ms, 10);
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
@@ -106,12 +106,12 @@
bool hasReceivedData = false;
clientFace->expressInterest(*interest,
- [&hasReceivedData] (const Interest&, const Data& data) {
+ [&] (const Interest&, const Data& data) {
hasReceivedData = true;
BOOST_CHECK_EQUAL(data.getName(), "/PQstEJGdL/aI7oCrDXNX");
},
- bind([] { BOOST_ERROR("unexpected Nack"); }),
- bind([] { BOOST_ERROR("unexpected timeout"); }));
+ [] (auto&&...) { BOOST_ERROR("unexpected Nack"); },
+ [] (auto&&...) { BOOST_ERROR("unexpected timeout"); });
this->advanceClocks(1_ms, 10);
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
@@ -129,12 +129,12 @@
bool hasReceivedNack = false;
clientFace->expressInterest(*interest,
- bind([] { BOOST_ERROR("unexpected Data"); }),
- [&hasReceivedNack] (const Interest&, const lp::Nack& nack) {
+ [] (auto&&...) { BOOST_ERROR("unexpected Data"); },
+ [&] (const Interest&, const lp::Nack& nack) {
hasReceivedNack = true;
BOOST_CHECK_EQUAL(nack.getReason(), lp::NackReason::NO_ROUTE);
},
- bind([] { BOOST_ERROR("unexpected timeout"); }));
+ [] (auto&&...) { BOOST_ERROR("unexpected timeout"); });
this->advanceClocks(1_ms, 10);
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
@@ -197,9 +197,9 @@
bool hasTimeout = false;
clientFace->expressInterest(*interest,
- bind([] { BOOST_ERROR("unexpected Data"); }),
- bind([] { BOOST_ERROR("unexpected Nack"); }),
- bind([&hasTimeout] { hasTimeout = true; }));
+ [] (auto&&...) { BOOST_ERROR("unexpected Data"); },
+ [] (auto&&...) { BOOST_ERROR("unexpected Nack"); },
+ [&] (auto&&...) { hasTimeout = true; });
BOOST_CHECK_NO_THROW(this->advanceClocks(1_ms, 200));
BOOST_CHECK_EQUAL(receivedInterests.size(), 0);