I know there is a boost::format and it's great. However, I needed something
faster and with more "conventional" syntax. That's the coutf library. I've
been using it for a few months and it's great.
Just to be clear, I'm not suggesting a replacement of boost::format, which
has several features that coutf does not. However in many cases you don't
need those and that's why coutf is a fair bit faster. Also the syntax is
more conventional and several people have mentioned they prefer that. I know
Alexandrescu has also created something similar to coutf (I think he called
it Printf), but I think mine is lighter, I think most people are not too
concerned about not being able to printf 45 parameters, plus it has the
Fmt/FmtGuard stuff :) .
Anyways the docs and code are at http://noptrlib.sf.net/utils/coutf, just
did another update today. Coutf could be a good second alternative to
boost::format for some people. Here are some examples of use:
coutf("Program started at %s:%s:%s\n", hours, minutes, seconds);
cerrf("Error: file %s, line %5s invalid\n", filename, lineNum);
std::string msg = strf("Hex of %s is %04Xs", 123, 123);
int count = 10;
std::ofstream ff("someFile.txt");
// prints array in hex format
{
FmtGuard fmt(ff, "%0#4x");
for (int i=0;i