2013-12-03 std::(unordered_)mapにキーが入っているかどうかを判定する stlのコンテナのfindメンバ関数は、条件に合うものが見つからない場合にendイテレーターを返します。 template <class M, class K> bool containsKey(const M& map, const K& key){ return map.find(key) != map.end( } 使用例 if(containsKey(table, "hoge")){ return table["hoge"]; } return null;