#include
#include
#include
#include
using namespace std;
int main()
{
list vals;
list divisors;
int i;
for(i =10; i <100; i+=10)
vals.push_back((double)i);
for(i =1; i <10; i++)
divisors.push_back(3.0);
cout << "Original contents of vals:\n";
list::iterator p = vals.begin();
while(p != vals.end()) {
cout << *p << " ";
p++;
}
cout << endl;
p = transform(vals.begin(),
vals.end(),
divisors.begin(),
vals.begin(),
divides()); // use function object
cout << "Divided contents of vals:\n";
p = vals.begin();
while(p != vals.end()) {
cout << *p << " ";
p++;
}
return 0;
}