Curiously Recurring Template Pattern

From cppreference.com
< cpp‎ | language

The Curiously Recurring Template Pattern is an idiom in which a class X derives from a class template Y, taking a template parameter Z, where Y is instantiated with Z=X. For example,

template<class Z>
class Y
{
};
 
class X : public Y<X>
{
};


See also

allows an object to create a shared_ptr referring to itself
(class template)
helper class template for defining views, using the curiously recurring template pattern
(class template)