#include
#include
#include
#include
int odd(int i)
{
return 2 * i + 1;
}
int square(int i)
{
return i * i;
}
typedef boost::counting_iterator counter;
typedef boost::transform_iterator transformer;
transformer odds(int n)
{
return transformer(counter(n), odd);
}
transformer squares(int n)
{
return transformer(counter(n), square);
}
int main()
{
using namespace std;
cout << "Enter vector length: ";<br> int n; cin >> n;
cout << inner_product( odds(0), odds(n), squares(0), 0 ) << endl;<br>