文学城论坛
+A-

Just a sample

乱弹 2009-05-10 12:37:42 ( reads)

class hotel {

public:
........
void printUncleanedrooms();

private:
map &lt int, bool&gt _roomStatus;
list &lt int &gt _uncleanedRooms;

};

void hotel::printUncleanedrooms() {
for(list &lt int &gt::iterator iter=_uncleanedRooms.begin(); iter!= _uncleanedRooms.end();) {
if(_roomStatus[*iter])
_uncleanedRooms.erase(iter++);
else
cout }
}

跟帖(2)

乱弹

2009-05-10 12:39:09

need to add "++iter" in the second case

戏雨飞鹰

2009-05-10 13:59:08

xiexie.