Hi,
I just wondering about two things with the format library.
1)
The following program crashes on windows - is this intentional?
#include
int main(int argc, char* argv[])
{
boost::format f("%s %s");
f.exceptions(boost::io::no_error_bits); // not needed, but just in case
char const* null_cstr = 0;
char const* empty_cstr = "";
f % empty_cstr; // triggers debug assertion failure
f % null_cstr; // triggers access violation
return EXIT_SUCCESS;
}
The debug assertion failure only happens on a debug build, of course.
I can understand the access violation on a null string, but that
feature makes it unsuitable for a sprintf replacement.
2)
Is there a way to determine the number of expected arguments in a
format object?
Looks like the basic_format::num_args_ is exactly what I'm looking
for, but I can't find this exposed anywhere.
Going through a loop and catching exceptions is one way of getting the
number of expected arguments, but it feels wrong.
--
Eld på åren og sol på eng gjer mannen fegen og fjåg. [Jøtul]
<demo> 2008 Tore Halvorsen || +052 0553034554