You may use the following:
namespace detail
{
template struct helper;
template struct helper { void operator() () const {std::cout << "pointer\n";} };
template struct helper { void operator() ()const {std::cout << "array\n";} };
}
template
void f(const T& )
{
detail::helper{}();
}
Live example