Suppose I have the following template class:
template <typename T>
struct Hello
{
struct Hi {};
};
I want to be able to create a function like this:
template <typename U>
void hello_hi(typename Hello<U>::Hi&)
{}
And use it like this:
int main()
{
hello_hi(Hello<int>::Hi{});
}
But C++ isn't able to deduce the type U
because it is a template argument of of Hello
, not Hi
. Is there some way I can deduce U
without setting it explicitly as a template argument of hello_hi
?