A small printf-like function using variadic templates
I find this to be a sweet demo, but I don't like the traps in it for the unwary. Like you mention, there is little validation of parameter counts. There is also a chance that the same location can be replaced multiple times, e.g. with a call to ext::format("%1", "%2", "%3, "%4", "hi!") resulting in "hi!". Perhaps you might consider that a bonus.

What I find most surprising in the code is this:


std::string replacement_string{(std::ostringstream{} &lt;&lt; val).str()};



I would probably have tended towards auto replacement_string{std::to_string(val)}; or, more likely, just embedded that in the call to regex_replace. Do you do this for compatibility with existing code that provides an overload for operator&lt;&lt; but not to_string?

Finally, I'm torn about the use of regex. It seems like a pretty big hammer without a lot of need, here, however it does keep the code short and sweet, and implicitly avoids an infinite loop that a flawed implementation might have with ext::format("%1", "%1").

Reviewing the tests, I find the Does_Not_Alter_Format_String test to be surprising as well. I would have thought the const qualifier would indicate this well enough.