Type-safe printer in C++ with printf-like syntax