Archives

All posts for the month April, 2015

For reasons that I cannot fathom, templates terrify many C++ programmers. Not just beginners; hang around any sizable C++ community for any length of time and you will inevitably see someone who is otherwise quite competent going to irrational lengths to avoid writing a template. This fear baffles me, because templates are not really any harder to write than non-templates – in fact, in many cases you can simply replace the hard-coded types with T, add the template declaration, and you’re done. This refusal to simply go generic when it is obviously the way to go can make an otherwise potentially useful bit of code almost entirely useless. Continue Reading

A while ago a guy I know was working on a program that involved a large number of “jobs” read from a file/database. The issue he had was that he wanted different “views” of those jobs – for example, he wanted a view of the jobs sorted by job ID, another of the jobs sorted by start/end time, another sorted by priority, and so on. Continue Reading