]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Stop using the boost version of tie and tuple by default
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 21 Jan 2022 17:17:15 +0000 (18:17 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 8 Feb 2022 16:33:21 +0000 (17:33 +0100)
Also try to pull a bit less of boost headers everywhere in our code
base.

36 files changed:
pdns/anadns.hh
pdns/auth-packetcache.hh
pdns/auth-querycache.cc
pdns/auth-querycache.hh
pdns/auth-zonecache.cc
pdns/auth-zonecache.hh
pdns/communicator.hh
pdns/dns.hh
pdns/dnsdist-dynbpf.cc
pdns/dnsdist-dynbpf.hh
pdns/dnsdist-lua.cc
pdns/dnsdistdist/dnsdist-lbpolicies.cc
pdns/dnsdistdist/dnsdist-rules.hh
pdns/dnsdistdist/dnsdist-tcp-downstream.hh
pdns/dnsparser.hh
pdns/dnssecsigner.cc
pdns/inflighter.cc
pdns/iputils.hh
pdns/ixfrutils.hh
pdns/misc.hh
pdns/mplexer.hh
pdns/namespaces.hh
pdns/recpacketcache.cc
pdns/recpacketcache.hh
pdns/recursor_cache.cc
pdns/recursor_cache.hh
pdns/recursordist/aggressive_nsec.hh
pdns/recursordist/negcache.cc
pdns/recursordist/negcache.hh
pdns/statnode.hh
pdns/syncres.cc
pdns/syncres.hh
pdns/tcpreceiver.cc
pdns/test-auth-zonecache_cc.cc
pdns/ueberbackend.cc
pdns/ws-auth.cc

index b1054bf9795e6493c69325b8c45a81bb97c0e37d..0ac51aebab8aa8e94134a04c66647ff93f77d623 100644 (file)
@@ -37,8 +37,8 @@ struct QuestionIdentifier
   bool operator<(const QuestionIdentifier& rhs) const
   {
     return 
-      tie(d_id,         d_qtype,     d_source,     d_dest,     d_qname) < 
-      tie(rhs.d_id, rhs.d_qtype, rhs.d_source, rhs.d_dest, rhs.d_qname);
+      std::tie(d_id,         d_qtype,     d_source,     d_dest,     d_qname) <
+      std::tie(rhs.d_id, rhs.d_qtype, rhs.d_source, rhs.d_dest, rhs.d_qname);
   }
 
 
index 618041cf17d091413dfcab3276eab0d68a7b43f2..efd11c0825743b64bbd2a3d2df67c6ebcf0ca1c0 100644 (file)
 #include "dns.hh"
 #include <boost/version.hpp>
 #include "namespaces.hh"
-using namespace ::boost::multi_index;
 
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/hashed_index.hpp> 
+#include <boost/multi_index/sequenced_index.hpp>
+#include <boost/multi_index/key_extractors.hpp>
+using namespace ::boost::multi_index;
 
 #include "dnspacket.hh"
 #include "lock.hh"
index 6913296d847fcca9b6b4f1ae1c836eacee6d7c1a..dea4583e9f3f1e239fea58f9e0c3d8b2e8ec8bb6 100644 (file)
@@ -97,7 +97,7 @@ void AuthQueryCache::insert(const DNSName &qname, const QType& qtype, vector<DNS
 
     bool inserted;
     cmap_t::iterator place;
-    tie(place, inserted) = map->insert(val);
+    std::tie(place, inserted) = map->insert(val);
 
     if (!inserted) {
       map->replace(place, std::move(val));
@@ -119,7 +119,7 @@ void AuthQueryCache::insert(const DNSName &qname, const QType& qtype, vector<DNS
 bool AuthQueryCache::getEntryLocked(const cmap_t& map, const DNSName &qname, uint16_t qtype, vector<DNSZoneRecord>& value, int zoneID, time_t now)
 {
   auto& idx = boost::multi_index::get<HashTag>(map);
-  auto iter = idx.find(tie(qname, qtype, zoneID));
+  auto iter = idx.find(std::tie(qname, qtype, zoneID));
 
   if (iter == idx.end()) {
     (*d_statnummiss)++;
index b5ee72db123d6a1f9b7f4abf2e1bc59f2df7cd07..20c8ffb4d4bcbd46008a25da799024e85eeba321 100644 (file)
 #include "dns.hh"
 #include <boost/version.hpp>
 #include "namespaces.hh"
-using namespace ::boost::multi_index;
 
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/hashed_index.hpp> 
+#include <boost/multi_index/sequenced_index.hpp>
+#include <boost/multi_index/key_extractors.hpp>
+using namespace ::boost::multi_index;
 
 #include "dns.hh"
 #include "dnspacket.hh"
index 80a0e469cd4edaa713b7b7c4d59b59e35cf876e1..b214a9b6f690377d55b7f3a97009f72a58bf3248 100644 (file)
@@ -74,7 +74,7 @@ void AuthZoneCache::clear()
   purgeLockedCollectionsVector(d_maps);
 }
 
-void AuthZoneCache::replace(const vector<tuple<DNSName, int>>& zone_indices)
+void AuthZoneCache::replace(const vector<std::tuple<DNSName, int>>& zone_indices)
 {
   if (!d_refreshinterval)
     return;
@@ -83,10 +83,10 @@ void AuthZoneCache::replace(const vector<tuple<DNSName, int>>& zone_indices)
   vector<cmap_t> newMaps(d_maps.size());
 
   // build new maps
-  for (const tuple<DNSName, int>& tup : zone_indices) {
-    const DNSName& zone = tup.get<0>();
+  for (const std::tuple<DNSName, int>& tup : zone_indices) {
+    const DNSName& zone = std::get<0>(tup);
     CacheValue val;
-    val.zoneId = tup.get<1>();
+    val.zoneId = std::get<1>(tup);
     auto& mc = newMaps[getMapIndex(zone)];
     auto iter = mc.find(zone);
     if (iter != mc.end()) {
@@ -101,11 +101,11 @@ void AuthZoneCache::replace(const vector<tuple<DNSName, int>>& zone_indices)
     // process zone updates done while data collection for replace() was already in progress.
     auto pending = d_pending.lock();
     assert(pending->d_replacePending); // make sure we never forget to call setReplacePending()
-    for (const tuple<DNSName, int, bool>& tup : pending->d_pendingUpdates) {
-      const DNSName& zone = tup.get<0>();
+    for (const std::tuple<DNSName, int, bool>& tup : pending->d_pendingUpdates) {
+      const DNSName& zone = std::get<0>(tup);
       CacheValue val;
-      val.zoneId = tup.get<1>();
-      bool insert = tup.get<2>();
+      val.zoneId = std::get<1>(tup);
+      bool insert = std::get<2>(tup);
       auto& mc = newMaps[getMapIndex(zone)];
       auto iter = mc.find(zone);
       if (iter != mc.end()) {
index 474b94641a6af0c049e52ec8dc8a839053ee2129..c1b91d2b580a35c214b16c4dbb6b3677fd0d0f00 100644 (file)
@@ -32,7 +32,7 @@ class AuthZoneCache : public boost::noncopyable
 public:
   AuthZoneCache(size_t mapsCount = 1024);
 
-  void replace(const vector<tuple<DNSName, int>>& zone);
+  void replace(const vector<std::tuple<DNSName, int>>& zone);
   void add(const DNSName& zone, const int zoneId);
   void remove(const DNSName& zone);
   void setReplacePending(); //!< call this when data collection for the subsequent replace() call starts.
@@ -91,7 +91,7 @@ private:
 
   struct PendingData
   {
-    std::vector<tuple<DNSName, int, bool>> d_pendingUpdates;
+    std::vector<std::tuple<DNSName, int, bool>> d_pendingUpdates;
     bool d_replacePending{false};
   };
   LockGuarded<PendingData> d_pending;
index 0ffeef30a7aa293ae208e69d163bd8dafef23af5..b799e0159e443e03eaf40a60999be0df09dccfbc 100644 (file)
@@ -50,7 +50,7 @@ struct SuckRequest
   std::pair<RequestPriority, uint64_t> priorityAndOrder;
   bool operator<(const SuckRequest& b) const
   {
-    return tie(domain, master) < tie(b.domain, b.master);
+    return std::tie(domain, master) < std::tie(b.domain, b.master);
   }
 };
 
index a23ad5ba157992e248c5fbe6520e00e92185eeca..d6de3b7adda1d0c2b6dfdcfc0cf8eea32e4bef06 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 #pragma once
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
-#include <boost/multi_index/key_extractors.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
 #include "qtype.hh"
 #include "dnsname.hh"
 #include <time.h>
index ec549c32f96b4cb0cfc590b972564c4c2fdc9919..c19844de73de005e1c9a87b1a9b3a58aa020ab85 100644 (file)
@@ -49,8 +49,8 @@ void DynBPFFilter::purgeExpired(const struct timespec& now)
 {
   auto data = d_data.lock();
 
-  typedef nth_index<container_t,1>::type ordered_until;
-  ordered_until& ou = get<1>(data->d_entries);
+  typedef boost::multi_index::nth_index<container_t,1>::type ordered_until;
+  ordered_until& ou = boost::multi_index::get<1>(data->d_entries);
 
   for (ordered_until::iterator it = ou.begin(); it != ou.end(); ) {
     if (it->d_until < now) {
index afe77965275583fb1357a777a159f2fbf0a1606d..907a7300b9e89ba58870cf9ec54f6cde83ad70d1 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/member.hpp>
 
 class DynBPFFilter
 {
@@ -59,12 +60,12 @@ private:
     ComboAddress d_addr;
     struct timespec d_until;
   };
-  typedef multi_index_container<BlockEntry,
-                                indexed_by <
-                                  ordered_unique< member<BlockEntry,ComboAddress,&BlockEntry::d_addr>, ComboAddress::addressOnlyLessThan >,
-                                  ordered_non_unique< member<BlockEntry,struct timespec,&BlockEntry::d_until> >
-                                  >
-                                > container_t;
+  typedef boost::multi_index_container<BlockEntry,
+                                       boost::multi_index::indexed_by <
+                                         boost::multi_index::ordered_unique< boost::multi_index::member<BlockEntry,ComboAddress,&BlockEntry::d_addr>, ComboAddress::addressOnlyLessThan >,
+                                         boost::multi_index::ordered_non_unique< boost::multi_index::member<BlockEntry,struct timespec,&BlockEntry::d_until> >
+                                         >
+                                       > container_t;
   struct Data {
     container_t d_entries;
     std::shared_ptr<BPFFilter> d_bpf{nullptr};
index d7c94ddad2219e4fcab86bef69b9b0090d6a9b76..d5a79a8e3b8dbc706bde820b5ef7ab15d8636ce6 100644 (file)
@@ -50,9 +50,7 @@
 #include "dnsdist-web.hh"
 
 #include "base64.hh"
-#include "dnswriter.hh"
 #include "dolog.hh"
-#include "lock.hh"
 #include "sodcrypto.hh"
 
 #ifdef HAVE_LIBSSL
@@ -60,7 +58,7 @@
 #endif
 
 #include <boost/logic/tribool.hpp>
-#include <boost/lexical_cast.hpp>
+#include <boost/uuid/string_generator.hpp>
 
 #ifdef HAVE_SYSTEMD
 #include <systemd/sd-daemon.h>
@@ -482,7 +480,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
                          }
 
                          if (vars.count("id")) {
-                           ret->setId(boost::lexical_cast<boost::uuids::uuid>(boost::get<string>(vars["id"])));
+                           ret->setId(boost::uuids::string_generator()((boost::get<string>(vars["id"]))));
                          }
 
                          if (vars.count("checkName")) {
@@ -2287,6 +2285,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
 #endif
     return result;
   });
+
   luaCtx.writeFunction("addDOHLocal", [client](const std::string& addr, boost::optional<boost::variant<std::string, std::shared_ptr<TLSCertKeyPair>, std::vector<std::pair<int, std::string>>, std::vector<std::pair<int, std::shared_ptr<TLSCertKeyPair>>>>> certFiles, boost::optional<boost::variant<std::string, std::vector<std::pair<int, std::string>>>> keyFiles, boost::optional<boost::variant<std::string, vector<pair<int, std::string>>>> urls, boost::optional<localbind_t> vars) {
     if (client) {
       return;
index d747ca763e071d52f1a30fc8b3cae5aaf4e008fc..39d465c7b8f4d9bc3564c440c772276d896f9071 100644 (file)
@@ -36,14 +36,14 @@ shared_ptr<DownstreamState> leastOutstanding(const ServerPolicy::NumberedServerV
     return servers[0].second;
   }
 
-  vector<pair<tuple<int,int,double>, size_t>> poss;
+  vector<pair<std::tuple<int,int,double>, size_t>> poss;
   /* so you might wonder, why do we go through this trouble? The data on which we sort could change during the sort,
      which would suck royally and could even lead to crashes. So first we snapshot on what we sort, and then we sort */
   poss.reserve(servers.size());
   size_t position = 0;
   for(const auto& d : servers) {
     if(d.second->isUp()) {
-      poss.emplace_back(make_tuple(d.second->outstanding.load(), d.second->order, d.second->latencyUsec), position);
+      poss.emplace_back(std::make_tuple(d.second->outstanding.load(), d.second->order, d.second->latencyUsec), position);
     }
     ++position;
   }
index dda702e4356b3dfbc0f6e6e47246418948791df6..92b1a150aa3e986deceba25f968beda4a97e7ac5 100644 (file)
  */
 #pragma once
 
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
+#include <boost/multi_index/key_extractors.hpp>
+
 #include "cachecleaner.hh"
 #include "dnsdist.hh"
 #include "dnsdist-ecs.hh"
index 547d266b8ab85137f8a51f2f5178d1f2eaec1994..da403655bc9c718f2f18100a703cce11e889c0c1 100644 (file)
@@ -1,5 +1,10 @@
 #pragma once
 
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
+#include <boost/multi_index/key_extractors.hpp>
+
 #include <queue>
 
 #include "sstuff.hh"
index 7d57daddbf97e05ab8cd5b61e1835c39903b790d..7f0ec5950d6552d95255d00c0bf3168d5c4c727e 100644 (file)
@@ -29,8 +29,6 @@
 // #include <netinet/in.h>
 #include "misc.hh"
 
-#include <boost/tuple/tuple.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include "dns.hh"
 #include "dnswriter.hh"
 #include "dnsname.hh"
@@ -303,10 +301,10 @@ struct DNSRecord
 
   bool operator<(const DNSRecord& rhs) const
   {
-    if(tie(d_name, d_type, d_class, d_ttl) < tie(rhs.d_name, rhs.d_type, rhs.d_class, rhs.d_ttl))
+    if(std::tie(d_name, d_type, d_class, d_ttl) < std::tie(rhs.d_name, rhs.d_type, rhs.d_class, rhs.d_ttl))
       return true;
     
-    if(tie(d_name, d_type, d_class, d_ttl) != tie(rhs.d_name, rhs.d_type, rhs.d_class, rhs.d_ttl))
+    if(std::tie(d_name, d_type, d_class, d_ttl) != std::tie(rhs.d_name, rhs.d_type, rhs.d_class, rhs.d_ttl))
       return false;
     
     string lzrp, rzrp;
@@ -329,10 +327,10 @@ struct DNSRecord
     if(b.d_name.canonCompare(a.d_name))
       return false;
 
-    if(tie(aType, a.d_class, a.d_ttl) < tie(bType, b.d_class, b.d_ttl))
+    if(std::tie(aType, a.d_class, a.d_ttl) < std::tie(bType, b.d_class, b.d_ttl))
       return true;
     
-    if(tie(aType, a.d_class, a.d_ttl) != tie(bType, b.d_class, b.d_ttl))
+    if(std::tie(aType, a.d_class, a.d_ttl) != std::tie(bType, b.d_class, b.d_ttl))
       return false;
     
     string lzrp, rzrp;
index 3536902ca48154043f58828d46181a79d6cdcf2d..cdf265e074ac4f58071e3babee36e9e41f4b3e58 100644 (file)
@@ -173,7 +173,7 @@ uint64_t signatureCacheSize(const std::string& str)
 
 static bool rrsigncomp(const DNSZoneRecord& a, const DNSZoneRecord& b)
 {
-  return tie(a.dr.d_place, a.dr.d_type) < tie(b.dr.d_place, b.dr.d_type);
+  return std::tie(a.dr.d_place, a.dr.d_type) < std::tie(b.dr.d_place, b.dr.d_type);
 }
 
 static bool getBestAuthFromSet(const set<DNSName>& authSet, const DNSName& name, DNSName& auth)
index 93d49f632f7b6ec7463c4af63712965f007f1331..e770ea4c4aecfe7f3cc2090cb4909b9b8207983b 100644 (file)
 #include "config.h"
 #endif
 #include <vector>
-#include <deque>
 #include <iostream>
 
 #include <boost/multi_index_container.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/key_extractors.hpp>
+
 #include <boost/format.hpp>
 #include <sys/time.h>
 #include <time.h>
index d704bb3e2a9a152291fb8fcef56f832572f5a9e7..ab948b0298a6cce0f33365e00786cfe8458349e2 100644 (file)
@@ -32,8 +32,6 @@
 #include "misc.hh"
 #include <netdb.h>
 #include <sstream>
-#include <boost/tuple/tuple.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 
 #include "namespaces.hh"
 
@@ -91,7 +89,7 @@ union ComboAddress {
 
   bool operator==(const ComboAddress& rhs) const
   {
-    if(boost::tie(sin4.sin_family, sin4.sin_port) != boost::tie(rhs.sin4.sin_family, rhs.sin4.sin_port))
+    if(std::tie(sin4.sin_family, sin4.sin_port) != std::tie(rhs.sin4.sin_family, rhs.sin4.sin_port))
       return false;
     if(sin4.sin_family == AF_INET)
       return sin4.sin_addr.s_addr == rhs.sin4.sin_addr.s_addr;
@@ -109,9 +107,9 @@ union ComboAddress {
     if(sin4.sin_family == 0) {
       return false;
     }
-    if(boost::tie(sin4.sin_family, sin4.sin_port) < boost::tie(rhs.sin4.sin_family, rhs.sin4.sin_port))
+    if(std::tie(sin4.sin_family, sin4.sin_port) < std::tie(rhs.sin4.sin_family, rhs.sin4.sin_port))
       return true;
-    if(boost::tie(sin4.sin_family, sin4.sin_port) > boost::tie(rhs.sin4.sin_family, rhs.sin4.sin_port))
+    if(std::tie(sin4.sin_family, sin4.sin_port) > std::tie(rhs.sin4.sin_family, rhs.sin4.sin_port))
       return false;
 
     if(sin4.sin_family == AF_INET)
@@ -614,7 +612,7 @@ public:
 
   bool operator==(const Netmask& rhs) const
   {
-    return tie(d_network, d_bits) == tie(rhs.d_network, rhs.d_bits);
+    return std::tie(d_network, d_bits) == std::tie(rhs.d_network, rhs.d_bits);
   }
 
   bool empty() const
@@ -1552,7 +1550,7 @@ public:
 
   bool operator==(const AddressAndPortRange& rhs) const
   {
-    return tie(d_addr, d_addrMask, d_portMask) == tie(rhs.d_addr, rhs.d_addrMask, rhs.d_portMask);
+    return std::tie(d_addr, d_addrMask, d_portMask) == std::tie(rhs.d_addr, rhs.d_addrMask, rhs.d_portMask);
   }
 
   bool operator<(const AddressAndPortRange& rhs) const
index d42ee124cb546aef35c956188e99a94a8c43a451..bce8c6b48fd900d7599ab91253aed18246713ab2 100644 (file)
 #pragma once
 
 #include <sys/types.h>
+
 #include <boost/multi_index_container.hpp>
+#include <boost/multi_index/key_extractors.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+
 #include "dnsparser.hh"
 #include "dnsrecords.hh"
 
index 92d8a2afc6457651c72fd49b4e1dff36d819a597..bedbf2c67c5d00a89e17e6c509c2c9d0ac37f62e 100644 (file)
 #include <regex.h>
 #include <limits.h>
 #include <type_traits>
-#include <boost/algorithm/string.hpp>
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
-#include <boost/multi_index/key_extractors.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
 
-using namespace ::boost::multi_index;
+#include <boost/algorithm/string.hpp>
 
 #include "dns.hh"
 #include <atomic>
@@ -321,16 +315,16 @@ inline uint64_t uSec(const struct timeval& tv)
 
 inline bool operator<(const struct timeval& lhs, const struct timeval& rhs)
 {
-  return tie(lhs.tv_sec, lhs.tv_usec) < tie(rhs.tv_sec, rhs.tv_usec);
+  return std::tie(lhs.tv_sec, lhs.tv_usec) < std::tie(rhs.tv_sec, rhs.tv_usec);
 }
 inline bool operator<=(const struct timeval& lhs, const struct timeval& rhs)
 {
-  return tie(lhs.tv_sec, lhs.tv_usec) <= tie(rhs.tv_sec, rhs.tv_usec);
+  return std::tie(lhs.tv_sec, lhs.tv_usec) <= std::tie(rhs.tv_sec, rhs.tv_usec);
 }
 
 inline bool operator<(const struct timespec& lhs, const struct timespec& rhs)
 {
-  return tie(lhs.tv_sec, lhs.tv_nsec) < tie(rhs.tv_sec, rhs.tv_nsec);
+  return std::tie(lhs.tv_sec, lhs.tv_nsec) < std::tie(rhs.tv_sec, rhs.tv_nsec);
 }
 
 
index 474ea89067ba1d8589174c6ed9f181a4d991a3f6..9ff4ab18c1693f7a8680ac6fa05c36fbc2cfa8d8 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 #pragma once
-#include <boost/function.hpp>
 #include <boost/any.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/hashed_index.hpp>
@@ -55,7 +52,7 @@ class FDMultiplexer
 {
 public:
   typedef boost::any funcparam_t;
-  typedef boost::function<void(int, funcparam_t&)> callbackfunc_t;
+  typedef std::function<void(int, funcparam_t&)> callbackfunc_t;
   enum class EventKind : uint8_t
   {
     Read,
@@ -196,11 +193,11 @@ public:
   std::vector<std::pair<int, funcparam_t>> getTimeouts(const struct timeval& tv, bool writes = false)
   {
     std::vector<std::pair<int, funcparam_t>> ret;
-    const auto tied = boost::tie(tv.tv_sec, tv.tv_usec);
+    const auto tied = std::tie(tv.tv_sec, tv.tv_usec);
     auto& idx = writes ? d_writeCallbacks.get<TTDOrderedTag>() : d_readCallbacks.get<TTDOrderedTag>();
 
     for (auto it = idx.begin(); it != idx.end(); ++it) {
-      if (it->d_ttd.tv_sec == 0 || tied <= boost::tie(it->d_ttd.tv_sec, it->d_ttd.tv_usec)) {
+      if (it->d_ttd.tv_sec == 0 || tied <= std::tie(it->d_ttd.tv_sec, it->d_ttd.tv_usec)) {
         break;
       }
       ret.emplace_back(it->d_fd, it->d_parameter);
index 9e1f3adaa8dae43c578f8a8619e3a560d5fd44eb..e4e3fa6b08bf9dbec4542d42bfd03f48f39b926b 100644 (file)
@@ -21,7 +21,6 @@
  */
 #pragma once
 
-#include <boost/tuple/tuple.hpp>
 #include <boost/format.hpp>
 #include <boost/optional.hpp>
 #include <iostream>
 #include <string>
 #include <vector>
 
-// We have a few paces where boost::tuple is used, and other places where an unscoped tuple is used
-// prefer the boost one for now. We might want to switch to std::tuple one day. Same for tie.
-using boost::make_tuple;
-using boost::tuple;
-using boost::tie;
-
 using std::cerr;
 using std::clog;
 using std::cout;
index dc36d898e93f9fcdd0c3a7ac134c35183d5d58a3..926bf8003fa86526981b46ae79e40788117e4f0f 100644 (file)
@@ -129,7 +129,7 @@ bool RecursorPacketCache::getResponsePacket(unsigned int tag, const std::string&
 {
   *qhash = canHashPacket(queryPacket, s_skipOptions);
   const auto& idx = d_packetCache.get<HashTag>();
-  auto range = idx.equal_range(tie(tag, *qhash, tcp));
+  auto range = idx.equal_range(std::tie(tag, *qhash, tcp));
 
   if (range.first == range.second) {
     d_misses++;
@@ -144,7 +144,7 @@ bool RecursorPacketCache::getResponsePacket(unsigned int tag, const std::string&
 {
   *qhash = canHashPacket(queryPacket, s_skipOptions);
   const auto& idx = d_packetCache.get<HashTag>();
-  auto range = idx.equal_range(tie(tag, *qhash, tcp));
+  auto range = idx.equal_range(std::tie(tag, *qhash, tcp));
 
   if (range.first == range.second) {
     d_misses++;
@@ -159,7 +159,7 @@ bool RecursorPacketCache::getResponsePacket(unsigned int tag, const std::string&
 void RecursorPacketCache::insertResponsePacket(unsigned int tag, uint32_t qhash, std::string&& query, const DNSName& qname, uint16_t qtype, uint16_t qclass, std::string&& responsePacket, time_t now, uint32_t ttl, const vState& valState, OptPBData&& pbdata, bool tcp)
 {
   auto& idx = d_packetCache.get<HashTag>();
-  auto range = idx.equal_range(tie(tag, qhash, tcp));
+  auto range = idx.equal_range(std::tie(tag, qhash, tcp));
   auto iter = range.first;
 
   for (; iter != range.second; ++iter) {
index a88fc558408aa0144cc406abdf33eaa20e7a0db0..df27be11ce5e0348f4aa1a3ab3059b174210fff4 100644 (file)
@@ -30,6 +30,7 @@
 #include <boost/multi_index/hashed_index.hpp>
 #include <boost/tuple/tuple_comparison.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
+#include <boost/multi_index/key_extractors.hpp>
 #include <boost/optional.hpp>
 
 #include "packetcache.hh"
index 159698db2b099b2ff9e2c7ad7fa16c2bd0ace34d..fa740b6110ff301aacd6eb570588d122cecc9d9d 100644 (file)
@@ -155,7 +155,7 @@ time_t MemRecursorCache::handleHit(MapCombo::LockedContent& content, MemRecursor
 MemRecursorCache::cache_t::const_iterator MemRecursorCache::getEntryUsingECSIndex(MapCombo::LockedContent& map, time_t now, const DNSName& qname, const QType qtype, bool requireAuth, const ComboAddress& who)
 {
   // MUTEX SHOULD BE ACQUIRED (as indicated by the reference to the content which is protected by a lock)
-  auto ecsIndexKey = tie(qname, qtype);
+  auto ecsIndexKey = std::tie(qname, qtype);
   auto ecsIndex = map.d_ecsIndex.find(ecsIndexKey);
   if (ecsIndex != map.d_ecsIndex.end() && !ecsIndex->isEmpty()) {
     /* we have netmask-specific entries, let's see if we match one */
@@ -221,7 +221,7 @@ MemRecursorCache::Entries MemRecursorCache::getEntries(MapCombo::LockedContent&
     map.d_cachedqname = qname;
     map.d_cachedrtag = rtag;
     const auto& idx = map.d_map.get<NameAndRTagOnlyHashedTag>();
-    map.d_cachecache = idx.equal_range(tie(qname, rtag));
+    map.d_cachecache = idx.equal_range(std::tie(qname, rtag));
     map.d_cachecachevalid = true;
   }
   return map.d_cachecache;
@@ -522,7 +522,7 @@ size_t MemRecursorCache::doWipeCache(const DNSName& name, bool sub, const QType
     }
     else {
       auto& ecsIdx = map->d_ecsIndex.get<HashedTag>();
-      auto ecsIndexRange = ecsIdx.equal_range(tie(name, qtype));
+      auto ecsIndexRange = ecsIdx.equal_range(std::tie(name, qtype));
       ecsIdx.erase(ecsIndexRange.first, ecsIndexRange.second);
     }
   }
@@ -564,7 +564,7 @@ bool MemRecursorCache::doAgeCache(time_t now, const DNSName& name, const QType q
 {
   auto& mc = getMap(name);
   auto map = mc.lock();
-  cache_t::iterator iter = map->d_map.find(tie(name, qtype));
+  cache_t::iterator iter = map->d_map.find(std::tie(name, qtype));
   if (iter == map->d_map.end()) {
     return false;
   }
index 9c610f480df26a09a74c53ce3cd9d12552a7b19f..51265b0a4329803710f991f1d0855ec076ec49e3 100644 (file)
@@ -261,7 +261,7 @@ public:
       return;
     }
 
-    auto key = tie(entry.d_qname, entry.d_qtype);
+    auto key = std::tie(entry.d_qname, entry.d_qtype);
     auto ecsIndexEntry = map.d_ecsIndex.find(key);
     if (ecsIndexEntry != map.d_ecsIndex.end()) {
       ecsIndexEntry->removeNetmask(entry.d_netmask);
index ec58593c2e2d2ef4f457572cb52144a264855128..eb9d2bfa01e48c4f6ce9f255c5040d85654e0d63 100644 (file)
@@ -28,6 +28,8 @@
 #include <boost/multi_index/key_extractors.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
 
+using namespace ::boost::multi_index;
+
 #include "base32.hh"
 #include "dnsname.hh"
 #include "dnsrecords.hh"
index ea526bd1e49217398a86c3046155878bd3ba2cbe..b11d4ea2651dc260da54a53525b27df983740614 100644 (file)
@@ -62,7 +62,7 @@ bool NegCache::getRootNXTrust(const DNSName& qname, const struct timeval& now, N
   auto& map = getMap(lastLabel);
   auto content = map.lock();
 
-  negcache_t::const_iterator ni = content->d_map.find(tie(lastLabel, qtnull));
+  negcache_t::const_iterator ni = content->d_map.find(std::tie(lastLabel, qtnull));
 
   while (ni != content->d_map.end() && ni->d_name == lastLabel && ni->d_auth.isRoot() && ni->d_qtype == qtnull) {
     // We have something
@@ -142,7 +142,7 @@ void NegCache::updateValidationStatus(const DNSName& qname, const QType& qtype,
 {
   auto& mc = getMap(qname);
   auto map = mc.lock();
-  auto range = map->d_map.equal_range(tie(qname, qtype));
+  auto range = map->d_map.equal_range(std::tie(qname, qtype));
 
   if (range.first != range.second) {
     range.first->d_validationState = newState;
@@ -161,7 +161,7 @@ size_t NegCache::count(const DNSName& qname)
 {
   auto& map = getMap(qname);
   auto content = map.lock();
-  return content->d_map.count(tie(qname));
+  return content->d_map.count(std::tie(qname));
 }
 
 /*!
@@ -174,7 +174,7 @@ size_t NegCache::count(const DNSName& qname, const QType qtype)
 {
   auto& map = getMap(qname);
   auto content = map.lock();
-  return content->d_map.count(tie(qname, qtype));
+  return content->d_map.count(std::tie(qname, qtype));
 }
 
 /*!
@@ -190,7 +190,7 @@ size_t NegCache::wipe(const DNSName& name, bool subtree)
   if (subtree) {
     for (auto& map : d_maps) {
       auto m = map.lock();
-      for (auto i = m->d_map.lower_bound(tie(name)); i != m->d_map.end();) {
+      for (auto i = m->d_map.lower_bound(std::tie(name)); i != m->d_map.end();) {
         if (!i->d_name.isPartOf(name))
           break;
         i = m->d_map.erase(i);
@@ -203,7 +203,7 @@ size_t NegCache::wipe(const DNSName& name, bool subtree)
 
   auto& map = getMap(name);
   auto content = map.lock();
-  auto range = content->d_map.equal_range(tie(name));
+  auto range = content->d_map.equal_range(std::tie(name));
   auto i = range.first;
   while (i != range.second) {
     i = content->d_map.erase(i);
index c2a0fcbf96a3f8dc6148abc151ae80325c7252c4..204406cbd20b403c2dd509b9e5481c1becde964b 100644 (file)
 
 #include <vector>
 #include <boost/multi_index_container.hpp>
+#include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/hashed_index.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
+#include <boost/multi_index/key_extractors.hpp>
 #include <boost/optional.hpp>
 #include "dnsparser.hh"
 #include "dnsname.hh"
index 586fe9891fa127144b167f8c117c3a2a9205704b..88b4a210aa7d1a63eb7fd7ee57208cc1e6da0a42 100644 (file)
@@ -60,7 +60,7 @@ public:
   void submit(const DNSName& domain, int rcode, unsigned int bytes, boost::optional<const ComboAddress&> remote);
 
   Stat print(unsigned int depth=0, Stat newstat=Stat(), bool silent=false) const;
-  typedef boost::function<void(const StatNode*, const Stat& selfstat, const Stat& childstat)> visitor_t;
+  typedef std::function<void(const StatNode*, const Stat& selfstat, const Stat& childstat)> visitor_t;
   void visit(visitor_t visitor, Stat& newstat, unsigned int depth=0) const;
   bool empty() const
   {
index 00544f84d7b1c95c7edc57b24a5824c8cfd6a3aa..e2c3f573e52c8b771b7777812b377f4e897c186b 100644 (file)
@@ -320,7 +320,7 @@ int SyncRes::AuthDomain::getRecords(const DNSName& qname, const QType qtype, std
   records.clear();
 
   // partial lookup
-  std::pair<records_t::const_iterator,records_t::const_iterator> range = d_records.equal_range(tie(qname));
+  std::pair<records_t::const_iterator,records_t::const_iterator> range = d_records.equal_range(std::tie(qname));
 
   SyncRes::AuthDomain::records_t::const_iterator ziter;
   bool somedata = false;
@@ -1675,7 +1675,7 @@ struct CacheKey
   QType type;
   DNSResourceRecord::Place place;
   bool operator<(const CacheKey& rhs) const {
-    return tie(type, place, name) < tie(rhs.type, rhs.place, rhs.name);
+    return std::tie(type, place, name) < std::tie(rhs.type, rhs.place, rhs.name);
   }
 };
 typedef map<CacheKey, CacheEntry> tcache_t;
index dd777e00f9b4fbcbffc770bef99da264c8cecc90..b9d9ffac692ccb387dd113733a447078650dd2df 100644 (file)
@@ -832,8 +832,8 @@ private:
     uint8_t qtype;
     bool operator<(const GetBestNSAnswer &b) const
     {
-      return boost::tie(qtype, qname, bestns) <
-       boost::tie(b.qtype, b.qname, b.bestns);
+      return std::tie(qtype, qname, bestns) <
+       std::tie(b.qtype, b.qname, b.bestns);
     }
   };
 
@@ -1002,14 +1002,14 @@ struct PacketIDCompare
 {
   bool operator()(const std::shared_ptr<PacketID>& a, const std::shared_ptr<PacketID>& b) const
   {
-    if (tie(a->remote, a->tcpsock, a->type) < tie(b->remote, b->tcpsock, b->type)) {
+    if (std::tie(a->remote, a->tcpsock, a->type) < std::tie(b->remote, b->tcpsock, b->type)) {
       return true;
     }
-    if (tie(a->remote, a->tcpsock, a->type) > tie(b->remote, b->tcpsock, b->type)) {
+    if (std::tie(a->remote, a->tcpsock, a->type) > std::tie(b->remote, b->tcpsock, b->type)) {
       return false;
     }
 
-    return tie(a->domain, a->fd, a->id) < tie(b->domain, b->fd, b->id);
+    return std::tie(a->domain, a->fd, a->id) < std::tie(b->domain, b->fd, b->id);
   }
 };
 
@@ -1017,10 +1017,10 @@ struct PacketIDBirthdayCompare
 {
   bool operator()(const std::shared_ptr<PacketID>& a, const std::shared_ptr<PacketID>& b) const
   {
-    if (tie(a->remote, a->tcpsock, a->type) < tie(b->remote, b->tcpsock, b->type)) {
+    if (std::tie(a->remote, a->tcpsock, a->type) < std::tie(b->remote, b->tcpsock, b->type)) {
       return true;
     }
-    if (tie(a->remote, a->tcpsock, a->type) > tie(b->remote, b->tcpsock, b->type)) {
+    if (std::tie(a->remote, a->tcpsock, a->type) > std::tie(b->remote, b->tcpsock, b->type)) {
       return false;
     }
     return a->domain < b->domain;
index 5de32cf86b3fb670cb2b0abf456325419cf76983..28f542648f800ba05808fe9dca9fec399ffb0c18 100644 (file)
@@ -828,7 +828,7 @@ int TCPNameserver::doAXFR(const DNSName &target, std::unique_ptr<DNSPacket>& q,
   // Group records by name and type, signpipe stumbles over interrupted rrsets
   if(securedZone && !presignedZone) {
     sort(zrrs.begin(), zrrs.end(), [](const DNSZoneRecord& a, const DNSZoneRecord& b) {
-      return tie(a.dr.d_name, a.dr.d_type) < tie(b.dr.d_name, b.dr.d_type);
+      return std::tie(a.dr.d_name, a.dr.d_type) < std::tie(b.dr.d_name, b.dr.d_type);
     });
   }
 
index 330f145201eb50e134bc6eb9fdffb1c7c7c4aba7..de183ab4259b1ca77e6509cd1286b99cfa565a97 100644 (file)
@@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(test_replace)
   AuthZoneCache cache;
   cache.setRefreshInterval(3600);
 
-  vector<tuple<DNSName, int>> zone_indices{
+  vector<std::tuple<DNSName, int>> zone_indices{
     {DNSName("example.org."), 1},
   };
   cache.setReplacePending();
@@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(test_add_while_pending_replace)
   AuthZoneCache cache;
   cache.setRefreshInterval(3600);
 
-  vector<tuple<DNSName, int>> zone_indices{
+  vector<std::tuple<DNSName, int>> zone_indices{
     {DNSName("powerdns.org."), 1}};
   cache.setReplacePending();
   cache.add(DNSName("example.org."), 2);
@@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(test_remove_while_pending_replace)
   AuthZoneCache cache;
   cache.setRefreshInterval(3600);
 
-  vector<tuple<DNSName, int>> zone_indices{
+  vector<std::tuple<DNSName, int>> zone_indices{
     {DNSName("powerdns.org."), 1}};
   cache.setReplacePending();
   cache.remove(DNSName("powerdns.org."));
@@ -95,7 +95,7 @@ BOOST_AUTO_TEST_CASE(test_add_while_pending_replace_duplicate)
   AuthZoneCache cache;
   cache.setRefreshInterval(3600);
 
-  vector<tuple<DNSName, int>> zone_indices{
+  vector<std::tuple<DNSName, int>> zone_indices{
     {DNSName("powerdns.org."), 1},
     {DNSName("example.org."), 2},
   };
index b2559e717823e675f460fe93ef7c0b0a647d5cf1..84243afdc49b6b587f66f0aa1f53cca764efedb8 100644 (file)
@@ -278,7 +278,7 @@ void UeberBackend::updateZoneCache() {
     return;
   }
 
-  vector<tuple<DNSName, int>> zone_indices;
+  vector<std::tuple<DNSName, int>> zone_indices;
   g_zoneCache.setReplacePending();
 
   for (vector<DNSBackend*>::iterator i = backends.begin(); i != backends.end(); ++i )
index 01c7bf32e3af474adf9630f7bd479bb723dad0b0..87333179d83f7fa8e8a2acfadf2bac9595ffe90c 100644 (file)
@@ -2048,7 +2048,7 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) {
     di.backend->getDomainMetadataOne(zonename, "SOA-EDIT", soa_edit_kind);
     bool soa_edit_done = false;
 
-    set<tuple<DNSName, QType, string>> seen;
+    set<std::tuple<DNSName, QType, string>> seen;
 
     for (const auto& rrset : rrsets.array_items()) {
       string changetype = toUpper(stringFromJson(rrset, "changetype"));