CRTP to avoid virtual member function overhead
问题 In CRTP to avoid dynamic polymorphism, the following solution is proposed to avoid the overhead of virtual member functions and impose a specific interface: template <class Derived> struct base { void foo() { static_cast<Derived *>(this)->foo(); }; }; struct my_type : base<my_type> { void foo() {}; // required to compile. < Don't see why }; struct your_type : base<your_type> { void foo() {}; // required to compile. < Don't see why }; However it seems that the derived class does not require a