#include <iostream>
#include <vector>
#include <utility>
using namespace std;
struct A {
int v;
int f1(const int &_v){
return v * _v;
}
int f2(const int &_v){
return v * _v * _v;
}
};
int main(){
A a[3];
for(unsigned int i(0); i < sizeof(a) / sizeof(a[0]); i++){
a[i].v = i + 1;
}
typedef vector<pair<A *, int (A::*)(const int &)> > vec_t;
vec_t vec;
for(unsigned int i(0); i < sizeof(a) / sizeof(a[0]); i++){
for(int j(0); j < 2; j++){
vec.push_back(vec_t::value_type(&a[i], j % 2 == 0 ? &A::f1 : &A::f2));
}
}
for(vec_t::const_iterator it(vec.begin()); it != vec.end(); ++it){
cout << ((it->first)->*(it->second))(2) << endl;
}
return 0;
}