working on c++ utility functions