detail: stop importing std::function into ndn namespace
Change-Id: I536774e974627abbf4e8b868ebb948b90ea5d4a6
diff --git a/ndn-cxx/detail/common.hpp b/ndn-cxx/detail/common.hpp
index 1136bd0..daf5f7a 100644
--- a/ndn-cxx/detail/common.hpp
+++ b/ndn-cxx/detail/common.hpp
@@ -49,7 +49,6 @@
#define NDN_CXX_PROTECTED_WITH_TESTS_ELSE_PRIVATE private
#endif
-#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <functional>
@@ -72,7 +71,6 @@
using std::dynamic_pointer_cast;
using std::const_pointer_cast;
-using std::function;
using std::to_string;
using namespace std::string_literals;
diff --git a/ndn-cxx/encoding/block.cpp b/ndn-cxx/encoding/block.cpp
index 6b14d87..6c525c5 100644
--- a/ndn-cxx/encoding/block.cpp
+++ b/ndn-cxx/encoding/block.cpp
@@ -31,6 +31,8 @@
#include <boost/asio/buffer.hpp>
#include <boost/range/adaptor/reversed.hpp>
+
+#include <algorithm>
#include <cstring>
namespace ndn {
diff --git a/ndn-cxx/encoding/encoder.hpp b/ndn-cxx/encoding/encoder.hpp
index 27177ad..82b5ea3 100644
--- a/ndn-cxx/encoding/encoder.hpp
+++ b/ndn-cxx/encoding/encoder.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,6 +24,8 @@
#include "ndn-cxx/encoding/block.hpp"
+#include <algorithm>
+
namespace ndn {
namespace encoding {
diff --git a/ndn-cxx/face.hpp b/ndn-cxx/face.hpp
index 0a16fea..b915398 100644
--- a/ndn-cxx/face.hpp
+++ b/ndn-cxx/face.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -47,42 +47,42 @@
/**
* @brief Callback invoked when an expressed Interest is satisfied by a Data packet
*/
-typedef function<void(const Interest&, const Data&)> DataCallback;
+using DataCallback = std::function<void(const Interest&, const Data&)>;
/**
* @brief Callback invoked when a Nack is received in response to an expressed Interest
*/
-typedef function<void(const Interest&, const lp::Nack&)> NackCallback;
+using NackCallback = std::function<void(const Interest&, const lp::Nack&)>;
/**
* @brief Callback invoked when an expressed Interest times out
*/
-typedef function<void(const Interest&)> TimeoutCallback;
+using TimeoutCallback = std::function<void(const Interest&)>;
/**
* @brief Callback invoked when an incoming Interest matches the specified InterestFilter
*/
-typedef function<void(const InterestFilter&, const Interest&)> InterestCallback;
+using InterestCallback = std::function<void(const InterestFilter&, const Interest&)>;
/**
* @brief Callback invoked when registerPrefix or setInterestFilter command succeeds
*/
-typedef function<void(const Name&)> RegisterPrefixSuccessCallback;
+using RegisterPrefixSuccessCallback = std::function<void(const Name&)>;
/**
* @brief Callback invoked when registerPrefix or setInterestFilter command fails
*/
-typedef function<void(const Name&, const std::string&)> RegisterPrefixFailureCallback;
+using RegisterPrefixFailureCallback = std::function<void(const Name&, const std::string&)>;
/**
* @brief Callback invoked when unregistering a prefix succeeds
*/
-typedef function<void()> UnregisterPrefixSuccessCallback;
+using UnregisterPrefixSuccessCallback = std::function<void()>;
/**
* @brief Callback invoked when unregistering a prefix fails
*/
-typedef function<void(const std::string&)> UnregisterPrefixFailureCallback;
+using UnregisterPrefixFailureCallback = std::function<void(const std::string&)>;
/**
* @brief Provide a communication channel with local or remote NDN forwarder
diff --git a/ndn-cxx/impl/common-pch.hpp b/ndn-cxx/impl/common-pch.hpp
index 539d977..61dd2c1 100644
--- a/ndn-cxx/impl/common-pch.hpp
+++ b/ndn-cxx/impl/common-pch.hpp
@@ -28,6 +28,7 @@
#include "ndn-cxx/detail/common.hpp"
// STL headers to precompile
+#include <algorithm>
#include <atomic>
#include <iterator>
#include <limits>
diff --git a/ndn-cxx/interest.cpp b/ndn-cxx/interest.cpp
index cd802cd..ad6c5c0 100644
--- a/ndn-cxx/interest.cpp
+++ b/ndn-cxx/interest.cpp
@@ -29,6 +29,7 @@
#include <boost/range/adaptor/reversed.hpp>
+#include <algorithm>
#include <cstring>
#include <sstream>
diff --git a/ndn-cxx/link.cpp b/ndn-cxx/link.cpp
index 9110bf8..c1ac3fb 100644
--- a/ndn-cxx/link.cpp
+++ b/ndn-cxx/link.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -21,6 +21,8 @@
#include "ndn-cxx/link.hpp"
+#include <algorithm>
+
namespace ndn {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Link>));
diff --git a/ndn-cxx/link.hpp b/ndn-cxx/link.hpp
index 02c0406..116ffba 100644
--- a/ndn-cxx/link.hpp
+++ b/ndn-cxx/link.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,6 +24,8 @@
#include "ndn-cxx/data.hpp"
+#include <initializer_list>
+
namespace ndn {
/**
diff --git a/ndn-cxx/meta-info.cpp b/ndn-cxx/meta-info.cpp
index f95b69d..2fde11e 100644
--- a/ndn-cxx/meta-info.cpp
+++ b/ndn-cxx/meta-info.cpp
@@ -22,6 +22,7 @@
#include "ndn-cxx/meta-info.hpp"
#include "ndn-cxx/encoding/block-helpers.hpp"
+#include <algorithm>
#include <boost/range/adaptor/reversed.hpp>
namespace ndn {
diff --git a/ndn-cxx/mgmt/dispatcher.cpp b/ndn-cxx/mgmt/dispatcher.cpp
index 2973abe..4bb1b7a 100644
--- a/ndn-cxx/mgmt/dispatcher.cpp
+++ b/ndn-cxx/mgmt/dispatcher.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,6 +23,8 @@
#include "ndn-cxx/lp/tags.hpp"
#include "ndn-cxx/util/logger.hpp"
+#include <algorithm>
+
NDN_LOG_INIT(ndn.mgmt.Dispatcher);
namespace ndn {
diff --git a/ndn-cxx/mgmt/nfd/controller.hpp b/ndn-cxx/mgmt/nfd/controller.hpp
index 1d56b56..7fdeb55 100644
--- a/ndn-cxx/mgmt/nfd/controller.hpp
+++ b/ndn-cxx/mgmt/nfd/controller.hpp
@@ -53,17 +53,17 @@
/**
* \brief Callback on command success.
*/
- using CommandSucceedCallback = function<void(const ControlParameters&)>;
+ using CommandSucceedCallback = std::function<void(const ControlParameters&)>;
/**
* \brief Callback on command failure.
*/
- using CommandFailCallback = function<void(const ControlResponse&)>;
+ using CommandFailCallback = std::function<void(const ControlResponse&)>;
/**
* \brief Callback on dataset retrieval failure.
*/
- using DatasetFailCallback = function<void(uint32_t code, const std::string& reason)>;
+ using DatasetFailCallback = std::function<void(uint32_t code, const std::string& reason)>;
/**
* \brief Construct a Controller that uses \p face as transport and \p keyChain to sign commands.
diff --git a/ndn-cxx/net/dns.hpp b/ndn-cxx/net/dns.hpp
index e3f8b7c..a2db537 100644
--- a/ndn-cxx/net/dns.hpp
+++ b/ndn-cxx/net/dns.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,8 +30,8 @@
namespace ndn {
namespace dns {
-typedef boost::asio::ip::address IpAddress;
-typedef function<bool (const IpAddress& address)> AddressSelector;
+using IpAddress = boost::asio::ip::address;
+using AddressSelector = std::function<bool(const IpAddress&)>;
struct AnyAddress
{
@@ -66,8 +66,8 @@
using std::runtime_error::runtime_error;
};
-typedef function<void (const IpAddress& address)> SuccessCallback;
-typedef function<void (const std::string& reason)> ErrorCallback;
+using SuccessCallback = std::function<void(const IpAddress& address)>;
+using ErrorCallback = std::function<void(const std::string& reason)>;
/** \brief Asynchronously resolve host
*
diff --git a/ndn-cxx/net/ethernet.cpp b/ndn-cxx/net/ethernet.cpp
index 65cb118..cced947 100644
--- a/ndn-cxx/net/ethernet.cpp
+++ b/ndn-cxx/net/ethernet.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022 Regents of the University of California,
+ * Copyright (c) 2014-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,6 +29,7 @@
#include <boost/functional/hash.hpp>
+#include <algorithm>
#include <cinttypes>
#include <cstdio>
#include <ostream>
diff --git a/ndn-cxx/net/face-uri.hpp b/ndn-cxx/net/face-uri.hpp
index bca98c9..412a4ea 100644
--- a/ndn-cxx/net/face-uri.hpp
+++ b/ndn-cxx/net/face-uri.hpp
@@ -152,8 +152,8 @@
bool
isCanonical() const;
- typedef function<void(const FaceUri&)> CanonizeSuccessCallback;
- typedef function<void(const std::string& reason)> CanonizeFailureCallback;
+ using CanonizeSuccessCallback = std::function<void(const FaceUri&)>;
+ using CanonizeFailureCallback = std::function<void(const std::string& reason)>;
/** \brief Asynchronously convert this FaceUri to canonical form.
* \param onSuccess function to call after this FaceUri is converted to canonical form
diff --git a/ndn-cxx/net/impl/netlink-message.hpp b/ndn-cxx/net/impl/netlink-message.hpp
index ba88856..ed2567b 100644
--- a/ndn-cxx/net/impl/netlink-message.hpp
+++ b/ndn-cxx/net/impl/netlink-message.hpp
@@ -35,6 +35,7 @@
#include <linux/rtnetlink.h>
#include <string.h>
+#include <algorithm>
#include <cstring>
#include <map>
#include <optional>
diff --git a/ndn-cxx/signature-info.cpp b/ndn-cxx/signature-info.cpp
index 0e8eed4..bba5682 100644
--- a/ndn-cxx/signature-info.cpp
+++ b/ndn-cxx/signature-info.cpp
@@ -24,6 +24,7 @@
#include "ndn-cxx/util/concepts.hpp"
#include "ndn-cxx/util/string-helper.hpp"
+#include <algorithm>
#include <boost/range/adaptor/reversed.hpp>
namespace ndn {
diff --git a/ndn-cxx/util/segment-fetcher.cpp b/ndn-cxx/util/segment-fetcher.cpp
index 02d566f..dcacf94 100644
--- a/ndn-cxx/util/segment-fetcher.cpp
+++ b/ndn-cxx/util/segment-fetcher.cpp
@@ -31,6 +31,7 @@
#include <boost/lexical_cast.hpp>
#include <boost/range/adaptor/map.hpp>
+#include <algorithm>
#include <cmath>
namespace ndn {
diff --git a/ndn-cxx/util/signal/signal.hpp b/ndn-cxx/util/signal/signal.hpp
index b60ef83..054529f 100644
--- a/ndn-cxx/util/signal/signal.hpp
+++ b/ndn-cxx/util/signal/signal.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -52,9 +52,10 @@
class Signal : noncopyable
{
public: // API for anyone
- /** \brief Represents a function that can connect to the signal.
+ /**
+ * \brief Represents a function that can connect to the signal.
*/
- typedef function<void(const TArgs&...)> Handler;
+ using Handler = std::function<void(const TArgs&...)>;
Signal();
diff --git a/tests/unit/face.t.cpp b/tests/unit/face.t.cpp
index 0ee95b4..7e5b7be 100644
--- a/tests/unit/face.t.cpp
+++ b/tests/unit/face.t.cpp
@@ -56,8 +56,8 @@
* \return whether the prefix registration succeeded.
*/
bool
- runPrefixReg(function<void(const RegisterPrefixSuccessCallback& success,
- const RegisterPrefixFailureCallback& failure)> f)
+ runPrefixReg(std::function<void(const RegisterPrefixSuccessCallback&,
+ const RegisterPrefixFailureCallback&)> f)
{
boost::logic::tribool result = boost::logic::indeterminate;
f([&] (auto) { result = true; },
@@ -72,8 +72,8 @@
* \return whether the prefix unregistration succeeded.
*/
bool
- runPrefixUnreg(function<void(const UnregisterPrefixSuccessCallback& success,
- const UnregisterPrefixFailureCallback& failure)> f)
+ runPrefixUnreg(std::function<void(const UnregisterPrefixSuccessCallback&,
+ const UnregisterPrefixFailureCallback&)> f)
{
boost::logic::tribool result = boost::logic::indeterminate;
f([&] { result = true; },