Tags » Meta-programming

A Meta Programming Use Case: Slugging

In PostIt!, there was a need to D.R.Y. up some of the repetitive code used for slugging URLs.  As you might imagine, the generation of the URL slugs was similar from model to model, apart from the column name seeded to generate the slug.   241 more words

Compile-Time Hash Using constexpr

In this blog entry I present a fairly simple implementation of the djb2 hash function using constexpr which enables the hash to be computed at compile-time. 380 more words


Composable Templated Vectors

In this blog entry, I present a code snippet demonstrating how a templated math vector class can have a construction interface which allows it to be composed of any number of smaller or equal-dimension vector types. 1,116 more words


Yes, a degree in computer science is worth it.

Or any formal course in computer science, for that matter.

Some people say that computer science is too theoretical, in reality you’ll never use the things that you learned. 679 more words


Detecting the Presence of a Member Function

In this blog entry, I present a code snippet to determine whether a given type contains a specific member function. The caller can indicate what types of parameters he intends on passing into the function. 1,393 more words


Code Katas

I found this post  by Jeff Atwood inspiring. I’ve always known code katas to be little self-contained programming puzzles, not unlike those algorithm questions that you prepare for your tech interviews, but it seems that they can be more “meta” than that. 485 more words


Generalized erasure for STL

An amazing way for generalizing erasure for elements from STL containers by “Stephan-T-Lavavej” from his STL video on Channel Nine using template Meta-programming.

Here is the code: 533 more words