From 27fe50dc92ca069deaefd6f255e59b74eaf00ef7 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 26 May 2020 12:46:04 +0200 Subject: [PATCH] :memo: add example for contains #2133 Closes #2133. --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 3ae3f7993..077a60bc6 100644 --- a/README.md +++ b/README.md @@ -544,6 +544,11 @@ for (auto& [key, value] : o.items()) { } // find an entry +if (o.contains("foo")) { + // there is an entry with key "foo" +} + +// or via find and an iterator if (o.find("foo") != o.end()) { // there is an entry with key "foo" }