From 1d4d67038aed2b0813941db1856a3b4a6f94a9aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Fri, 22 Jan 2016 12:37:20 -0500
Subject: [PATCH] dht: fix compilation on older clang

---
 include/opendht/dht.h | 14 +++++++-------
 src/dht.cpp           |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/opendht/dht.h b/include/opendht/dht.h
index dd6ae5fa..8fed6bcc 100644
--- a/include/opendht/dht.h
+++ b/include/opendht/dht.h
@@ -276,7 +276,7 @@ public:
     /**
      * Get locally stored data for the given key and value id.
      */
-    std::shared_ptr<Value> getLocalById(const InfoHash& key, const Value::Id& vid) const;
+    std::shared_ptr<Value> getLocalById(const InfoHash& key, Value::Id vid) const;
 
     /**
      * Announce a value on all available protocols (IPv4, IPv6), and
@@ -736,6 +736,12 @@ private:
 
         const std::vector<ValueStorage>& getValues() const { return values; }
 
+        std::shared_ptr<Value> getById(Value::Id vid) const {
+            for (auto& v : values)
+                if (v.data->id == vid) return v.data;
+            return {};
+        }
+
         std::vector<std::shared_ptr<Value>> get(Value::Filter f = {}) const {
             std::vector<std::shared_ptr<Value>> newvals {};
             if (not f) newvals.reserve(values.size());
@@ -746,12 +752,6 @@ private:
             return newvals;
         }
 
-        std::shared_ptr<Value> get(Value::Id vid) const {
-            for (auto& v : values)
-                if (v.data->id == vid) return v.data;
-            return {};
-        }
-
         /**
          * Stores a new value in this storage, or replace a previous value
          *
diff --git a/src/dht.cpp b/src/dht.cpp
index 310d5f0a..55d7fafb 100644
--- a/src/dht.cpp
+++ b/src/dht.cpp
@@ -1679,11 +1679,11 @@ Dht::getLocal(const InfoHash& id, Value::Filter f) const
 }
 
 std::shared_ptr<Value>
-Dht::getLocalById(const InfoHash& id, const Value::Id& vid) const
+Dht::getLocalById(const InfoHash& id, Value::Id vid) const
 {
     auto s = findStorage(id);
     if (s != store.end())
-        return s->get(vid);
+        return s->getById(vid);
     return {};
 }
 
-- 
GitLab