//: C05:TransformNames.cpp // From Thinking in C++, 2nd Edition // Available at http://www.BruceEckel.com // (c) Bruce Eckel 2000 // Copyright notice in Copyright.txt // More use of transform() #include "Inventory.h" #include "PrintSequence.h" #include #include #include using namespace std; struct NewImproved { Inventory operator()(const Inventory& inv) { return Inventory(toupper(inv.getItem()), inv.getQuantity(), inv.getValue()); } }; int main() { vector vi; generate_n(back_inserter(vi), 15, InvenGen()); print(vi, "vi"); transform(vi.begin(), vi.end(), vi.begin(), NewImproved()); print(vi, "vi"); } ///:~