📝 add example for contains #2133

Closes #2133.
pull/2144/head
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
1 changed files with 5 additions and 0 deletions

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