Category: C++


Largest / Smallest. Part 2

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 […]

Largest / Smallest. Part 1

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 […]