Why did I start it? I wrote the Embedded Template Library (ETL), and all the others I have written over the years, because I’m lazy. Yes, lazy! But in a good way I believe. See here. Don’t Re-invent The Wheel I hate having to code yet another variation of the same thing in a slightly […]
Category: Embedded Template Library
A C++ template library tailored for embedded projects.
In the last post i showed you how to implement a ‘Largest’ traits template using pre-C++11. In this post I will show you how to do the same using variadic templates. First we declare the ‘bare’ template. It tells the compiler that ‘Largest’ take an unknown number of template parameters. Next, we create helper templates […]
Sometimes, when multiple types are sent as template parameters, some information about the types needs to be interrogated to be able to configure another property of the template. The STL’s type traits header does a good job of supplying many of the more useful ones, but there is room for extension. Say, for instance, the […]
The purpose of this template is to simplify the creation of classes that implement the Observer Pattern and attempt to eliminate certain runtime errors by turning them into compile time errors. The pattern consists of two template classes. Observer and Observable. Observable The class derived from this will be observed by classes derived from Observer. It […]
Introduction There are probably many of you out there who, like me, have investigated the possibilities that templates and template meta-programming can bring to your code. After having some success with templated image and image algorithm classes, I turned my attention to seeing whether some of the design patterns I use could be encapsulated in […]
In the last post I showed how to shrink the vtable overhead and reduce the coupling of the framework. This time I shall show how to reduce the vtable hit even further using another technique called the Curiously Recurring Template Pattern or CRTP. This oddly name pattern is a way of replacing runtime virtual calls […]