CRTP Dispatch in C++11
问题 Say I have the following code: template <class Derived> class Base { public: virtual void foo_impl() = 0; void foo() { static_cast<Derived*>(this)->foo_impl(); //A (*static_cast<Derived*>(this)).foo_impl(); //B } }; class Derived : public Base<Derived> { private: void foo_impl() { bar(); } }; A few questions: Will line A generate a virtual function call? Although the majority of what I can find on the internet recommends doing things this way, to me I don't see how the compiler can do static