C++ generic library