August 2017
Intermediate to advanced
438 pages
14h 19m
English
The boost::format class accepts the string that specifies the resulting string format. Arguments are passed to boost::format using operator%. Values %1%, %2%, %3%, %4%, and so on, in the format specifying string are replaced by arguments passed to boost::format.
We also disable the exceptions for cases when a format string contains fewer arguments than passed to boost::format:
boost::format f(format_specifier); unsigned char flags = boost::io::all_error_bits; flags ^= boost::io::too_many_args_bit;
This is done to allow some formats like this:
// Outputs 'Reader'. std::cout << class_instance.to_string("%2%\n\n");
Read now
Unlock full access