mhappy:
一小段STL,为啥最后调用printit不用带参数呢?
[阅读: 436] 2006-10-16 03:27:45
PrintIt (string& StringToPrint) {
cout << StringToPrint << endl;
}
int main (void) {
list<string> FruitAndVegetables;
FruitAndVegetables.push_back("carrot");
FruitAndVegetables.push_back("pumpkin");
FruitAndVegetables.push_back("potato");
FruitAndVegetables.push_front("apple");
FruitAndVegetables.push_front("pineapple");
for_each (FruitAndVegetables.begin(), FruitAndVegetables.end(), PrintIt);
}