Jonathan Boccara's blog

My Christmas Gift For You

Published December 24, 2019 - 0 Comments

Tonight is Christmas!

Jingle bells, jingle bells, jingle all the way…

I hope that you’re enjoying this special part of the year!

As it is customary to offer gifts to each other at Christmas, let me offer you my gift:

Untie the knot, tear the wrapping paper open, lift the lid of the box and you find…

A mini-ebook on the CRTP!

The CRTP, standing for the Curiously Recurring Template Pattern is a C++ technique mixing inheritance and templates, that allows to extend the features of a class.

This ebook contains several parts. It starts with a description of the CRTP: which class inherits from which, where the templates are, how the class communicate with each other, and so on.

It then continues with what this pattern can bring to your code. Going beyond the mere technical description, this second part shows the meaning of the CRTP and in which situations it can improve your code.

Then the ebook shows how to make the CRTP code look better. When using the CRTP, the code typically is littered with static_cast<Derived const&>(*this) everywhere. The third part of the ebook is about a helper class that hides those expressions.

The ebook then explores mixin classes, which are like the CTRP upside down. It puts the CRTP in perspective and shows another C++ technique.

And finally, since the CRTP uses compile-time polymorphism you can use it to improve performance when you don’t need runtime polymorphism. The last part of the ebook shows how to turn a hierarchy of virtual methods into a CRTP.

Download your Christmas ebook here!

I hesitated between offering a Christmas jumper and a CRTP ebook, but 1) I don’t know how to make a jumper and 2) you can’t download a jumper. So I went for the CRTP ebook 🙂

Want more of them?

I hope you’ll like the ebook. This kind of document approaching a given topic under different angles if the best way I know to get a deep understanding of that topic.

This is the kind of ebook that I send every month to Fluent C++ patrons, each month on a new topic. This allows to get in-depth understanding of a C++ topic every month, which allows to do continuous learning.

If you’d also like to receive a mini-ebook every month and support Fluent C++, become a Patron! The January 2020 issue coming out in a few days is about the variadic CRTP, which goes further in the CRTP by using variadic templates.

Merry Christmas!

Dear Fluent C++ reader, I wish you a fantastic Christmas, I wish you to take some time to relax, get together with people you care about, and enjoy this very special time of the year.

Merry Christmas!

Jonathan

Don't want to miss out ? Follow:   twitterlinkedinrss
Share this post!Facebooktwitterlinkedin