Sundry C++ utility code