08/02/25 14:03:08
>>665
それぞれの型の応じて関数を振り分ければいいのか?
template<size_t N>
void g(const char (&a)[N]) {
cout << typeid(a).name() << endl;
}
template<size_t N>
void g(char (&a)[N]) {
cout << typeid(a).name() << endl;
}
void g(char *&p)
{
cout << typeid(p).name() << endl;
}
template<typename T>
void f(T& t)
{
g(t);
}