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/tools/ndn-autoconfig-server/program.cpp b/tools/ndn-autoconfig-server/program.cpp
index d0be0d1..21e7857 100644
--- a/tools/ndn-autoconfig-server/program.cpp
+++ b/tools/ndn-autoconfig-server/program.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -67,7 +67,9 @@
m_face.put(*data);
}
},
- bind(&Program::handlePrefixRegistrationFailure, this, _1, _2));
+ [this] (auto&&... args) {
+ handlePrefixRegistrationFailure(std::forward<decltype(args)>(args)...);
+ });
}
void
@@ -84,8 +86,10 @@
m_dispatcher.addTopPrefix(ROUTABLE_PREFIXES_DATA_PREFIX, false);
m_face.registerPrefix(Name(ROUTABLE_PREFIXES_DATA_PREFIX).append(ROUTABLE_PREFIXES_DATA_SUFFIX),
- nullptr,
- bind(&Program::handlePrefixRegistrationFailure, this, _1, _2));
+ nullptr,
+ [this] (auto&&... args) {
+ handlePrefixRegistrationFailure(std::forward<decltype(args)>(args)...);
+ });
}
void