Curiously recurring template pattern: Difference between revisions

Content deleted Content added
Add simplified CRTP with C++23 feature, deducing this
m it's > its - it's does not mean belonging to it, it is only a contraction of it is, or it has
Line 248:
 
The use of CRTP can be simplified using the [[C++23]] feature, deducing this.<ref>{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0847r7.html|title=Deducing this|date=2021-07-12|author1=Gašper Ažman|author2=Sy Brand|author3=Ben Deane|author4=Barry Revzin
}}</ref><ref>{{Cite web|title=Explicit object parameter|url=https://en.cppreference.com/w/cpp/language/member_functions#Explicit_object_parameter|access-date=27 December 2023}}</ref> For the function <code>signature_dish</code> to call a derived member function <code>cook_signature_dish</code>, <code>ChefBase</code> needs to be a templated type and <code>CafeChef</code> needs to inherit from <code>ChefBase</code>, passing it'sits type as the template parameter.
 
<syntaxhighlight lang="cpp">