March 2012
1 post
5 tags
Conditional Inheritance in Python
I was messing around earlier today, trying to come up with a decent default value for a class to be imported in a build system I’ve been writing for a bit now. I was using a silly if-elif-else chain, and a function to return the proper class. I then wondered if it would be possible to have a default class using conditional inheritance. In python the ternary is expressed like so:
x = value...
February 2012
1 post
7 tags
Substitution Failure Is Not An Error (It Is Also...
Last time, I wrote about SFINAE in relation to functions. This time, I’ll be
covering their use in structs, and all the neat little things this lets you
do.
I had promised to show off a neat trick involving platform specific code
within templates with extremely minimal use of the C preprocessor (simple
defines are used).
Unfortunately, I found out that accrding to the C++11 standard that...
December 2011
1 post
6 tags
Substitution Failure Is Not An Error (It is also...
With the finalization of the new C++ standard, I’ve begun tinkering with some features of the language that I haven’t really needed until now, or chose a hackier route. At the suggestion of a friend, I’ve decided to ‘esplain’ what I’ve done recently that, aside from basic #ifndef and #include statement, allows the circumvention for platform or compiler specific...