Entries by Rainer Grimm

Avoiding Temporaries with Expression Templates

Expression templates are typically used in linear algebra and are  “structures representing a computation at compile-time, which are evaluated only as needed to produce efficient code for the entire computation” (https://en.wikipedia.org/wiki/Expression_templates). In other words, expression templates are only evaluated when needed. 

Mixins

In my previous  post “More about Dynamic and Static Polymorphism”, I used the Curiously Recurring Template Pattern (CRTP) to implement static polymorphism. Another typical use case for CRTP is mixins.

More About Me

Do you want to participate in my mentoring program “Fundamentals for C++ Professionals”? Of course, you want to read more about me on my mentoring page: About Rainer Grimm.    

constexpr if

In today’s post, I want to introduce an exciting C++17 feature: constexpr if. constexpr if enables it to compile source code conditionally and can be used for nice tricks at compile time.