A collection of useful c++ functions