Tags » Meta-programming

Generating and calling code on the fly: VBA delegates.

That’s one of the problems I’ve been wanting to solve in VBA for ages, but never really spent the time to actually do it. This weekend I thought I’d tackle it for real, and ended up quite quickly with a working solution. 613 more words

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


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


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