summaryrefslogtreecommitdiff
path: root/icespider/core/flatMap.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-09-05 02:14:40 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-12-17 15:36:04 +0000
commit388918afc582f562afd9942bd19e70b7e7f2bb8e (patch)
treed4b8f3889521f6e6416185d3aa65c94fefbbe066 /icespider/core/flatMap.h
parentconstexpr string_view some more stuff (diff)
downloadicespider-388918afc582f562afd9942bd19e70b7e7f2bb8e.tar.bz2
icespider-388918afc582f562afd9942bd19e70b7e7f2bb8e.tar.xz
icespider-388918afc582f562afd9942bd19e70b7e7f2bb8e.zip
Add contains to flatmap
Diffstat (limited to 'icespider/core/flatMap.h')
-rw-r--r--icespider/core/flatMap.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/icespider/core/flatMap.h b/icespider/core/flatMap.h
index 33e1f24..e23bd46 100644
--- a/icespider/core/flatMap.h
+++ b/icespider/core/flatMap.h
@@ -18,6 +18,11 @@ namespace IceSpider {
{
return c(v.first, n);
}
+ bool
+ operator()(const N & n, const V & v) const
+ {
+ return c(n, v.first);
+ }
Comp c;
};
@@ -43,6 +48,13 @@ namespace IceSpider {
template<typename N>
auto
+ contains(const N & n) const
+ {
+ return std::binary_search(begin(), end(), n, KeyComp<N> {});
+ }
+
+ template<typename N>
+ auto
find(const N & n) const
{
const auto lb = lower_bound(n);