Various utility functions and classes for C++