関数型言語スレからパクってきた。
関数型言語って、チャーチ数見たいに
関数自体をデータとして扱えるってのは必須要件なのかね?

template<class> struct F;
template<class> struct Count;
template<class type> struct Count< F<type> >
{
      enum{ value = Count< type >::value + 1 };
}

template<> struct Count< void >
{
      enum{ value =  0 };
};

Count< F< F< F< F<void> > > >::value == 4;