Hi,

I'm using boost::format library, and this may be obvious to those experienced users:  is there any way to detect the mismatch of number of expected arguments in a
boost::format object?  Both of the following statements throw out runtime exceptions (which is correct):

std::cout << boost::format ("%s %s") % "Hello"; 
std::cout << boost::format ("%s") % "Hello" % "world"; 

It'd be great if this type of parameter-mismatch error can be caught at compile-time, instead of run-time.  We use boost::format library extensively for logging, and inevitably there're human errors like this mismatched number of arguments.  IMHO, this kind of error should have been detected by compiler at build time, s.t. the developer won't be embarrassed by QA or customers at run-time.

Actually, what's even worse is the following that doesn't generate error at all:

std::cout << boost::format ("%s %s") % "Hello" % 12345; 

There's a type-mismatch ('char*' versus 'int') for the second argument, but there's neither compile-time nor run-time error. The output is "Hello 12345", which may be correct, but it may not be what the programmer intended to do.

Any way of turning those typo into compile-time error?

--- Jeffrey