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/daemon/mgmt/manager-base.hpp b/daemon/mgmt/manager-base.hpp
index e061217..eeb55f5 100644
--- a/daemon/mgmt/manager-base.hpp
+++ b/daemon/mgmt/manager-base.hpp
@@ -97,10 +97,10 @@
* This is called after the signature has been validated.
*
* @param interest a request for ControlCommand
- * @param accept callback of successful validation, takes the requester string as a argument
+ * @param accept callback of successful validation, takes the requester string as argument
*/
- void
- extractRequester(const Interest& interest, ndn::mgmt::AcceptContinuation accept);
+ static void
+ extractRequester(const Interest& interest, const ndn::mgmt::AcceptContinuation& accept);
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
/**
@@ -127,7 +127,7 @@
const ControlCommandHandler& handler,
const Name& prefix, const Interest& interest,
const ndn::mgmt::ControlParameters& params,
- ndn::mgmt::CommandContinuation done);
+ const ndn::mgmt::CommandContinuation& done);
/**
* @brief Generates the relative prefix for a handler by appending the verb name to the module name.
@@ -148,7 +148,7 @@
};
template<typename Command>
-inline void
+void
ManagerBase::registerCommandHandler(const std::string& verb,
const ControlCommandHandler& handler)
{
@@ -157,8 +157,8 @@
m_dispatcher.addControlCommand<ControlParameters>(
makeRelPrefix(verb),
makeAuthorization(verb),
- bind(&ManagerBase::validateParameters, std::cref(*command), _1),
- bind(&ManagerBase::handleCommand, command, handler, _1, _2, _3, _4));
+ [=] (const auto& params) { return validateParameters(*command, params); },
+ [=] (auto&&... args) { handleCommand(command, handler, std::forward<decltype(args)>(args)...); });
}
} // namespace nfd