Compress redundant C++ code