The other day, I discovered that this was possible:
template <class T> struct base {};
struct derived: base<int> {};
int main()
{
// The base class template is accessible here
typename derived::base<double> x;
// from the comments, even this works
typename derived::derived::base<double>::base<int>::base<void> y;
}
I have no recollection of ever reading this on cppreference or in C++ tutorials, or this being exploited in clever template metaprogramming tricks (because I'm sure it can be). I have several questions:
- Does this thing have a specific name?
- Where is it documented in the C++ standard and on cppreference?
- Is there any template metaprogramming trick exploiting this?