static-polymorphism

Does C++ have a static polymorphism implementation of interface that does not use vtable?

Does C++ have a proper implementation of interface that does not use vtable? for example class BaseInterface{ public: virtual void func() const = 0; } class BaseInterfaceImpl:public BaseInterface{ public: void func(){ std::cout<<"called."<<endl; } } BaseInterface* obj = new BaseInterfaceImpl(); obj->func(); the call to func at the ...

CRTP & multilevel inheritance

I have a class hierarchy and want to get rid of virtual method calls overhead using CRTP pattern. How to do this for my example classes, is it doable ? class A { public: virtual ~A(); virtual void foo(); }; class B : public A { public: virtual ~B(); virtual void foo(); }; class C : public B { public: virtual ~C(); ...

What's the use of the derived class as a template parameter?

What's the purpose of this pattern? What is it called? It looked very strange when I saw it the first time, though I have now seen it many times. template<typename Derived> struct Base { //... }; struct Example : Base<Example> { //... }; ...