*2 trait (somefunc_internal_typeを定義していない型だけ渡すとコンパイルエラー) template<typename T>struct somefunc_internal_type{}; template<>struct somefunc_internal_type<float>{ using type = double; }; template<>struct somefunc_internal_type<double>{ using type = double; }; template<>struct somefunc_internal_type<short>{ using type = int64_t; };
template<typename T, typename Ti = somefunc_internal_type<T>::type> double somefunc(T* src0, T* src1, int t){}
規則性があるならtraitsはenable_ifとかで少なく書けるが、深入りするとC++の闇にのまれるからおすすめしない using type = double; を typedef double type; に変えたらたぶんVS2008でも使える