OK, so this is just utterly geeky, and would really only come in handy if you're writing something like SafeInt –

How to tell if a numeric template type is a bool at compile time:

isBool = ((T)1 == (T)2)

if type T is a bool, then this is true, else it's an int.

How to tell if a type is an int or a float:

isFloat = ((T)1.1 > (T)1)

This one's a little more obvious:

isSigned = ((T)-1 < 0)

SafeInt 3 is coming soon – got it all working with the test rig last week, fixed a couple of bugs.

Speaking of testing, this is how to do things – don't even think about testing this thing with code review – tried that, and even many educated eyes didn't find all the problems. Speaking of many eyes, SafeInt 1.0.7 and 2.0 have been public for a long time, and there were a couple of minor issues, but the many eyes haven't found anything. Good thing I have a really good tester. Anyway, the test harness is cool – I just plug in the new code to the test harness, it doesn't fuzz, but it does try every corner case you could ever find, and then I just fix bugs until the test harness quits complaining. Keeps me from introducing regressions, too. Even if you don't have team programming, writing a test harness to validate your code and throw some evil inputs at it while you're at it will seriously improve quality. It's why a lot of the time, I'll get something working outside of the Office build environment, then once I'm fairly sure it works, THEN I port it over.