Introduction to OOP | Chapter 20: The STL : | next | previous | audio | real | text |
void inventory::order (int wid) // process an order for a widget with given id number { cout << "Received order for widget type " << wid << endl; list<Widget>::iterator we_have = find_if(on_hand.begin(), on_hand.end(), WidgetTester(wid)); if (we_have != on_hand.end()) { cout << "Ship " << *wehave << endl; on_hand.erase(we_have); } else { cout << "Back order widget of type " << wid << endl; on_order.push_front(wid); } }