#include <iostream>
#include <list>
#include <functional>
#include <algorithm>
using namespace std;
int main()
{
list<double> l;
list<double> divisors;
int i;
for(i=10; i<100; i+=10) l.push_back((double)i);
for(i=1; i<10; i++) divisors.push_back(3.0);
list<double>::iterator p = l.begin();
while(p != l.end()) {
cout << *p << endl;
p++;
}
p = transform(l.begin(), l.end(),divisors.begin(), l.begin(),divides<double>()); // call function object
p = l.begin();
while(p != l.end()) {
cout << *p << " ";
p++;
}
return 0;
}
|