C++ utility functions