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/examples/consumer-with-timer.cpp b/examples/consumer-with-timer.cpp
index b3b35ee..2f9c4d4 100644
--- a/examples/consumer-with-timer.cpp
+++ b/examples/consumer-with-timer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2019 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).
*
@@ -54,9 +54,9 @@
std::cout << "Sending Interest " << interest << std::endl;
m_face.expressInterest(interest,
- bind(&ConsumerWithTimer::onData, this, _1, _2),
- bind(&ConsumerWithTimer::onNack, this, _1, _2),
- bind(&ConsumerWithTimer::onTimeout, this, _1));
+ std::bind(&ConsumerWithTimer::onData, this, _1, _2),
+ std::bind(&ConsumerWithTimer::onNack, this, _1, _2),
+ std::bind(&ConsumerWithTimer::onTimeout, this, _1));
// Schedule a new event
m_scheduler.schedule(3_s, [this] { delayedInterest(); });
@@ -104,9 +104,9 @@
std::cout << "Sending Interest " << interest << std::endl;
m_face.expressInterest(interest,
- bind(&ConsumerWithTimer::onData, this, _1, _2),
- bind(&ConsumerWithTimer::onNack, this, _1, _2),
- bind(&ConsumerWithTimer::onTimeout, this, _1));
+ std::bind(&ConsumerWithTimer::onData, this, _1, _2),
+ std::bind(&ConsumerWithTimer::onNack, this, _1, _2),
+ std::bind(&ConsumerWithTimer::onTimeout, this, _1));
}
private:
diff --git a/examples/consumer.cpp b/examples/consumer.cpp
index ef6cd76..5808c99 100644
--- a/examples/consumer.cpp
+++ b/examples/consumer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2019 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).
*
@@ -46,9 +46,9 @@
std::cout << "Sending Interest " << interest << std::endl;
m_face.expressInterest(interest,
- bind(&Consumer::onData, this, _1, _2),
- bind(&Consumer::onNack, this, _1, _2),
- bind(&Consumer::onTimeout, this, _1));
+ std::bind(&Consumer::onData, this, _1, _2),
+ std::bind(&Consumer::onNack, this, _1, _2),
+ std::bind(&Consumer::onTimeout, this, _1));
// processEvents will block until the requested data is received or a timeout occurs
m_face.processEvents();
diff --git a/examples/producer.cpp b/examples/producer.cpp
index 516e1c0..d88cc86 100644
--- a/examples/producer.cpp
+++ b/examples/producer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2019 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).
*
@@ -39,9 +39,9 @@
run()
{
m_face.setInterestFilter("/example/testApp",
- bind(&Producer::onInterest, this, _1, _2),
+ std::bind(&Producer::onInterest, this, _1, _2),
nullptr, // RegisterPrefixSuccessCallback is optional
- bind(&Producer::onRegisterFailed, this, _1, _2));
+ std::bind(&Producer::onRegisterFailed, this, _1, _2));
m_face.processEvents();
}