aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-10-26 18:59:11 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-10-26 19:17:12 -0700
commit8a952743a3a3f856f6be6b985158ea1c1ffb2c6f (patch)
tree12af2484b365d6018d1fff9a7d761962b2353b4e
parent286625e09eb4e2334062b65cf45fc1dee5fedb66 (diff)
downloadvcpkg-8a952743a3a3f856f6be6b985158ea1c1ffb2c6f.tar.gz
vcpkg-8a952743a3a3f856f6be6b985158ea1c1ffb2c6f.zip
Introduce Util::Sets::contains()
-rw-r--r--toolsrc/include/vcpkg/base/util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h
index d5db6b6ee..7ffd027f0 100644
--- a/toolsrc/include/vcpkg/base/util.h
+++ b/toolsrc/include/vcpkg/base/util.h
@@ -20,6 +20,15 @@ namespace vcpkg::Util
}
}
+ namespace Sets
+ {
+ template<class Container, class T = ElementT<Container>>
+ bool contains(const Container& container, const T& item)
+ {
+ return container.find(item) != container.cend();
+ }
+ }
+
template<class Cont, class Func>
using FmapOut = decltype(std::declval<Func>()(*begin(std::declval<Cont>())));