Is there a string format class which act like DiagnosticBuilder?

It’s very convenient to define a diagnostic syntax and use operator << to add parameters.

I’m currently doing some code generation jobs and want to use the grammar which is used in defining diagnostic errors, some sort like this:
StringStream << “class ‘%0’ : %select{public|private}1 ‘%2’” << “Foo” << 0 << “Bar” << std::endl;

Is there any code to do this?