How does the second call to meow() compile here?
#include <iostream>
struct F {
struct E {
using is_it_safe = bool;
};
E e;
};
template<typename T, typename = typename T::E::is_it_safe>
const void* meow(T const& t)
{
return &t;
}
int main() {
F f;
meow(f); // meow<F, bool>
meow(f.e); // meow<F::E, bool> ??
}
F::E doesn't have a nested E, so how does the compiler deduce the second template parameter?
Ehas an injected-class-name, so thatE::Eis itself (E).So
F::E::E::is_it_safeisbool, sinceF::E::Eis theEclass: