Performance of pIter != cont.end() in for loop
问题 I was getting through "Exceptional C++" by Herb Sutter lately, and I have serious doubts about a particular recommendation he gives in Item 6 - Temporary Objects. He offers to find unnecessary temporary objects in the following code: string FindAddr(list<Employee> emps, string name) { for (list<Employee>::iterator i = emps.begin(); i != emps.end(); i++) { if( *i == name ) { return i->addr; } } return ""; } As one of the example, he recommends to precompute the value of emps.end() before the