Lifetime of references in STD collections
问题 How long is a reference to an element returned by an STD collection, such as a map, valid? For example, in this code: struct Employee{ int salary; string name; // the key }; map<string,Employee> allemployees; ... Employee & Joe = allemployees["Joe Smith"]; Joe.salary=150; // change "Joe Smith"'s salary assert(allemployees["Joe Smith"].salary==150); //always true .... allemployees["Mark Jones"]= Employee(); ... // No "Joe Smith" operations in the dots Joe.salary=200; assert (allemployees["Joe