{"title":"std::map \u306e\u7bc4\u56f2 for \u6587\u5185\u3067 operator[] \u3092\u4f7f\u308f\u306a\u3044","provider_url":"https://hatena.blog","type":"rich","url":"https://null-mn.hatenablog.com/entry/2021/11/03/092718","version":"1.0","description":"\u30d0\u30b0\u3063\u305f\u306e\u3067\u30e1\u30e2 \u7a81\u7136\u3067\u3059\u304c\u6b21\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u304c\u3042\u308a\u307e\u3059\u3002 #include <bits/stdc++.h> using namespace std; int main() { map<int, int> mp; mp[0] = 1, mp[1] = 2; int sum = 0; for (auto [key, val] : mp) { cout << key << \" \" << val << \"\\n\"; sum += mp[key + 1]; } cout << sum << \"\\n\"; } map \u306e\u5168\u3066\u306e key \u306b\u5bfe\u3057\u3066 mp[key+1] \u3092\u6c42\u3081\u308b\u30b3\u30fc\u30c9\u3067\u3059\u3002mp[0+1] = 2,\u2026","width":"100%","image_url":null,"provider_name":"Hatena Blog","blog_title":"\u30e1\u30e2\u5e33","author_url":"https://blog.hatena.ne.jp/null_mn/","categories":[],"height":"190","blog_url":"https://null-mn.hatenablog.com/","author_name":"null_mn","published":"2021-11-03 09:27:18","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnull-mn.hatenablog.com%2Fentry%2F2021%2F11%2F03%2F092718\" title=\"std::map \u306e\u7bc4\u56f2 for \u6587\u5185\u3067 operator[] \u3092\u4f7f\u308f\u306a\u3044 - \u30e1\u30e2\u5e33\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>"}