]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/stdalgo.h
Add ipv6 dnsbl support
[user/henk/code/inspircd.git] / include / stdalgo.h
index cb01a250aac37e2dffc30cd0d069afeae6a9befa..3e00a4cdcd93030cdb2d3c56e1b48dac24599261 100644 (file)
@@ -112,4 +112,16 @@ namespace stdalgo
                }
                return false;
        }
+
+       /**
+        * Check if an element with the given value is in a container. Equivalent to (std::find(cont.begin(), cont.end(), val) != cont.end()).
+        * @param cont Container to find the element in
+        * @param val Value of the element to look for
+        * @return True if the element was found in the container, false otherwise
+        */
+       template <template<typename, typename> class Cont, typename T, typename Alloc>
+       inline bool isin(const Cont<T, Alloc>& cont, const T& val)
+       {
+               return (std::find(cont.begin(), cont.end(), val) != cont.end());
+       }
 }