4 Answers
4

Take a look at QString's arg methods. Those seem to be something you're looking for.

You can definitely roll your own, although implementation might turn out to be not really trivial, especially if you would like it to support printf format specifiers. If printf style is not necessary, chaining a replace_all kind of calls sounds doable.

Can you write code like that above - yes you can. But you cannot portable write a variadic function without at least one non-variadic parameter. In printf(), for example, this is the format string. In other words, you can write function s like:

The answer you flagged gets around it by defaulting the arguments. But what this should teach the newbies is that defaulting the arguments doesn't mean that arguments aren't passed, it means that you don't have to type them.