]> granicus.if.org Git - pdns/commitdiff
Add has_key method
authorAki Tuomi <cmouse@desteem.org>
Sun, 29 Nov 2015 10:22:11 +0000 (12:22 +0200)
committerAki Tuomi <cmouse@desteem.org>
Sun, 29 Nov 2015 10:41:04 +0000 (12:41 +0200)
pdns/iputils.hh

index ed862b623b70b4809e7e7b57ba3dc6d50a6e94eb..63662128ac96eac21c616af8e548091df3f327ad 100644 (file)
@@ -547,6 +547,12 @@ public:
     insert(key_type(mask)).second = value;
   }
 
+  //<! check if given key is present in TreeMap
+  bool has_key(const key_type& key) const {
+    const node_type *ptr = lookup(key);
+    return ptr && ptr->first == key;
+  }
+
   //<! Returns "best match" for key_type, which might not be value
   const node_type* lookup(const key_type& value) const {
     return lookup(value.getNetwork(), value.getBits());