In some cases, the generic nature of templates makes it difficult to know or spell out certain types in the template code. The following three special
typeof varieties are useful in such cases. Although they are introduced in this chapter, they also work in non-templated code.
typeof(this) generates the type of the
this reference. It works in any struct or class, even outside of member functions: