#include <deque>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
void
printer (int i)
{
cout << i << ", ";
}
struct MultiAdd:public binary_function < int, int, int >
{
int operator () (const int &_Left, const int &_Right) const
{
return 2 * (_Left + _Right);
}
};
int
main ()
{
int mynumbers[] = { 8, 9, 7, 6, 4, 1 };
deque < int >d1 (mynumbers, mynumbers + 6);
deque < int >d2 (6); //LINE I
transform (d1.begin (), d1.end (), d2.begin (), bind2nd (MultiAdd (), 1));; //LINE II
for_each (d2.begin (), d2.end (), printer);
return 0;
}
I2luY2x1ZGUgPGRlcXVlPgoKI2luY2x1ZGUgPGlvc3RyZWFtPgoKI2luY2x1ZGUgPGFsZ29yaXRobT4KCiNpbmNsdWRlIDxmdW5jdGlvbmFsPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnZvaWQKcHJpbnRlciAoaW50IGkpCnsKCiAgY291dCA8PCBpIDw8ICIsICI7Cgp9CgpzdHJ1Y3QgTXVsdGlBZGQ6cHVibGljIGJpbmFyeV9mdW5jdGlvbiA8IGludCwgaW50LCBpbnQgPgp7CgogIGludCBvcGVyYXRvciAoKSAoY29uc3QgaW50ICZfTGVmdCwgY29uc3QgaW50ICZfUmlnaHQpIGNvbnN0CiAgewogICAgcmV0dXJuIDIgKiAoX0xlZnQgKyBfUmlnaHQpOwogIH0KCn07CgppbnQKbWFpbiAoKQp7CgogIGludCBteW51bWJlcnNbXSA9IHsgOCwgOSwgNywgNiwgNCwgMSB9OwoKICBkZXF1ZSA8IGludCA+ZDEgKG15bnVtYmVycywgbXludW1iZXJzICsgNik7CgogIGRlcXVlIDwgaW50ID5kMiAoNik7ICAgICAgICAvL0xJTkUgSQoKICB0cmFuc2Zvcm0gKGQxLmJlZ2luICgpLCBkMS5lbmQgKCksIGQyLmJlZ2luICgpLCBiaW5kMm5kIChNdWx0aUFkZCAoKSwgMSkpOzsgICAgLy9MSU5FIElJCgogIGZvcl9lYWNoIChkMi5iZWdpbiAoKSwgZDIuZW5kICgpLCBwcmludGVyKTsKCiAgcmV0dXJuIDA7Cgp9Cg==