First page Back Continue Last page Graphics
Program Notes
After initializing, the collection contains the values 1 to 9:
- initialized: 1 2 3 4 5 6 7 8 9
The first call of for_each( ) adds 10 to each value:
- ... AddValue(10) ...
- Here the expression AddValue(10) creates an object of type AddValue that is initialized with the value 10. The constructor of AddValue stores this value as the member theValue. Inside for_each( ), “( )” is called for each element of coll.
- after adding 10: 11 12 13 14 15 16 17 18 19