Skip to content

Instantly share code, notes, and snippets.

@nus
Created January 9, 2012 10:26
Show Gist options
  • Save nus/1582347 to your computer and use it in GitHub Desktop.
Save nus/1582347 to your computer and use it in GitHub Desktop.
未設定キーに対する値の参照
#include <iostream>
#include <map>
#include <string>
int main()
{
using namespace std;
map<string, string> container;
string &value1 = container["value1"];
value1 = "value1";
cout << "container[\"value1\"]: " << container["value1"] << endl; // container["value1"]: value1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment