Wondering about this… template argument deduction succeeds for the explicitly-typed variable, fails in the auto case. (Also, it succeeds either way for an equivalently-typed unary operator template). template struct Foo { T m_t; }; template Foo operator/=(Foo foo, function fn) { return fn(foo.m_t); } void mystery() { auto foo = Foo{1}; // this works… function… Continue reading C++ Guru Question
Category: Programming
An Interesting C++ Technique
I recently discovered a C++ technique I haven’t seen recognized before in any books, articles, or mentioned online anywhere (search terms are difficult perhaps). For want of a better name I call it Structural Capture. Consider the following code: #include #include using namespace std; //————————————————————— struct Foo { template Foo(const T& t) { m_outputFunc =… Continue reading An Interesting C++ Technique
RIP drm
This week, Dennis M. Ritchie, co-creator of C and Unix, died. His death has not made the front page like Steve Jobs’ did. But although the non-tech world had never heard of him, he was more important than Jobs. I can still remember buying my copy of K&R, that slim volume that was my reference… Continue reading RIP drm
How a Bug Made Me a Better Programmer
This is the tale of a bug. A challenging bug I encountered some time ago, and which changed my career for the better. It was late 2004. I was lead multiplayer engineer on Goldeneye: Rogue Agent, a title which could charitably be described as mediocre, but I like to think the networked multiplayer game was… Continue reading How a Bug Made Me a Better Programmer
I wrote my first Python program
Last Friday. Knowing almost no Python at noon, by 5pm I had some code to munge XML and do something useful for my current project. So it’s not bad. It’s good for productivity. Mostly because: It has useful libraries. Bread-and-butter data structures are built in, i.e. lists and dictionaries. I don’t care too much about… Continue reading I wrote my first Python program
Functional Rainbow
(Part of) what I do all day
Lately I’ve been asked what I do at work. What I really do. Well, if Great Biggary can frequently expound on his latest Maya scripts and python excursions, here goes with my explanations… Most of what I do all day is read code. Just like an author or poet will read many many more books… Continue reading (Part of) what I do all day
Why Reading Books Matters to a Programmer
The programming book market these days is small. Nothing like what it was eight years ago or so. And apparently, programmers don’t read books (any more). It’s mostly true. But of course, there are still books worth reading. I’m going to take as read the easy arguments: let’s assume that you’ve already pared away all… Continue reading Why Reading Books Matters to a Programmer
Curve and Vector
Curve (com.elbeno.curve) is my common lisp package for doing cool things with two-dimensional curves. In particular, modulating cubic Bézier curves and splines, but also approximating arbitrary elliptical and circular arc segments with cubic Bézier curves. It depends on Vector (com.elbeno.vector), a cobbled together set of functionality for representing and manipulating points on the 2D Cartesian… Continue reading Curve and Vector
Approximating elliptical arcs with Bézier curves
In doing my modulation work with curves and ellipses, I extended the vecto function for drawing an ellipse to enable an oriented ellipse. Lately it occurred to me that this didn’t go far enough in terms of functionality, and I began wondering about how to draw part of an elliptical arc. Vecto’s ellipse drawing function… Continue reading Approximating elliptical arcs with Bézier curves