I have a primary template function:
template <typename T, int U>
void print() {
std::cout << "int is " << U << std::endl;
}
How to make a partial specialization for function print, so that U is inferred based on a type of T?
For example:
template <typename T>
void print<T, 1>(); // If T is float
template <typename T>
void print<T, 2>(); // If T is Eigen::half
print<float>();
// Prints "int is 1"
print<Eigen::half>();
// Prints "int is 2"