Main concepts ============== .. highlight:: c++ Static object-oriented paradigm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Object-oriented programming (OOP) has many advantages which are desirable for complex high-level code. However, classic OOP (e.g. in C++) heavily relies on virtual methods to implement abstraction and polymorphism. Such an approach has a significant run-time overhead: - selecting the good method to call adds an indirection (the software have to check the virtual table) - abstract/virtual methods cannot be inlined, resulting in a overhead for very simple methods (e.g. setters/getters). In a few word, we want the main benefits of OOP (abstraction, re-usability) and the efficiency of low-level languages. One solution in C++ is to use the "curiously recurring template pattern" (`http://en.wikipedia.org/wiki/Curiously_Recurring_Template_Pattern `__). Here is the idea: :: template struct Base { void interface() { static_cast(this)->implementation(); } void f() { for(int i = 0; i < 3; ++i) interface(); } }; struct Derived : public Base { void implementation() { std::cout<<"impl"<