// Example 13-13: Wrapping the pow function in a function object.
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <ostream>
#include <vector>

double power(double x, double y)
{
  return std::pow(x, y);
}

int main()
{
  std::vector<long double> a, b, c;

  a.push_back(2.0);
  a.push_back(3.0);
  b.push_back(4.0);
  b.push_back(2.0);
  c.resize(2);
  std::transform(a.begin(), a.end(), b.begin(), c.begin(),
                 std::ptr_fun(power));
  std::copy(c.begin(), c.end(),
            std::ostream_iterator<long double>(std::cout, "\n"));
}

