自分でもイマイチtemplateが分かってないような気がするのですが、

template<typename T, typename R, class GV> R total(T* t, int n, GV getValue)
{
 R ret;
 for(int i=0; i<n; ++i)
 {
  ret += getValue(t[i]);  
 }
 return ret;
}

class Person
{
 int age_;
pubic:
 Person() : { age_ = rand() % 80; }
 int getAge() const { return age_; }
};

main()
{
 Person ps[50]; 
 cout << total(ps, 50, std::mem_fun(&Person::getAge) << endl;
}

これが通って希望通りの動作をするようにするにはどう変更すればいいでしょうか?
自分でtemplateを書いて使う勉強をしてるので、accumulateを使えとかそういうのはいいです。