Last Updated: June 6, 2026
CRTP, the Curiously Recurring Template Pattern, is a C++ idiom where a class inherits from a template base that takes the derived class itself as a template argument. The pattern looks strange at first (class Product : public Comparable<Product>), but it solves a real problem: getting polymorphic-looking code without paying the cost of virtual function calls. The base class can call methods on the derived class at compile time, with no vtable lookup, no indirect jump, and full opportunity for the compiler to inline everything away.