📝 add example for contains #2133

Closes #2133.
This commit is contained in:
Niels Lohmann 2020-05-26 12:46:04 +02:00
parent 25aab7ee41
commit 27fe50dc92
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69

View File

@ -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"
}