Monday 15 July 2019

Willful Ignorance (C++ Templates)

I had a moment last week where I was a little down on my C++, you see I'm a very old programmer, by programmer standards, and my experience with C++ stems from a time before templates, this may amaze and delight in equal measure as template use is so ubiquitous today, however I've been using find & replace style boiler-plate code in the form of both macros and code-gen for literally decades.

Templates however have not been my go to option, because of that weight of experience.  I actually find picking apart heavy template code quite hard going at times (I think a lot of us do).

But I was down as a valued colleague (Hi D if you read this, you know it's you) described this approach of mine as "willful ignorance".  And he was right, I have to put my hands up and admit he's right.

As such I took a look over my old state machine repo on github and realised there was a bunch of boiler plate stuff I was doing with both macros, or not doing at all, which could easily be made to leverage templates.

Watch this space...