Logo

Programming-Idioms

Determine whether the map m contains an entry for the key k
Implementation
C++

Implementation edit is for fixing errors and enhancing with metadata. Please do not replace the code below with a different implementation.

Instead of changing the code of the snippet, consider creating another C++ implementation.

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
import java.util.Map;
m.containsKey(k)
_, ok := m[k]
k in m
array_key_exists($k, $m)
exists $m->{$k}
k in m
use std::collections::HashMap;
m.contains_key(&k)
if (k in m) { }
m.containsKey(k)
uses fgl, classes;
m.IndexOf(k) >= 0
m.include?(k)
Map.has_key?(m, k)
(/=Nothing) (lookup k m)
maps:is_key(K, M).
m[k] ~= nil
#include <map>
bool key_exists = m.find(k) != m.end();
m.key?(k)
m.has_key?(k)
(assoc k m)
import qualified Data.Map.Strict as Map
Map.member k m
bool keyExists = m.ContainsKey(key)
m.contains(k)
m.hasOwnProperty(k)
m.containsKey(k)
(contains? m k)
_m.has(_k)
#include <map>
bool key_exists = m.contains(k);
If m.ContainsKey(k) Then...
@import Foundation;
if (m[k]) ...
(nth-value 1 (gethash k m))
m includesKey: k.
M.Contains (K)