Curiously recurring template pattern: Difference between revisions

Content deleted Content added
Removing link(s) to "Timothy Budd": Deleted page.
Object counter: Remove plural apostrophes.
Line 103:
</syntaxhighlight>
 
Each time an object of class <code>X</code> is created, the constructor of <code>counter<X></code> is called, incrementing both the created and alive count. Each time an object of class <code>X</code> is destroyed, the alive count is decremented. It is important to note that <code>counter<X></code> and <code>counter<Y></code> are two separate classes and this is why they will keep separate counts of <code>X</code>'s and <code>Y</code>'s. In this example of CRTP, this distinction of classes is the only use of the template parameter (<code>T</code> in <code>counter<T></code>) and the reason why we cannot use a simple un-templated base class.
 
== Polymorphic chaining ==