summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/stl_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/bits/stl_map.h')
-rw-r--r--libstdc++-v3/include/bits/stl_map.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index b81a2c4b7fc..fdd058b060d 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -1223,6 +1223,25 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#endif
//@}
+#if __cplusplus > 201703L
+ //@{
+ /**
+ * @brief Finds whether an element with the given key exists.
+ * @param __x Key of (key, value) pairs to be located.
+ * @return True if there is an element with the specified key.
+ */
+ bool
+ contains(const key_type& __x) const
+ { return _M_t.find(__x) != _M_t.end(); }
+
+ template<typename _Kt>
+ auto
+ contains(const _Kt& __x) const
+ -> decltype(_M_t._M_find_tr(__x), void(), true)
+ { return _M_t._M_find_tr(__x) != _M_t.end(); }
+ //@}
+#endif
+
//@{
/**
* @brief Finds the beginning of a subsequence matching given key.