Boost logo

Boost Users :

Subject: [Boost-users] Boost.Format for variadic numbers of arguments
From: Philipp Moeller (philipp.moeller_at_[hidden])
Date: 2012-02-20 05:43:27

I currently have a lot of code that formats list into something

Is it possible to do something like:

  boost::format fmt("List [ %V,%]");

  std::vector<std::string> c = {"foo", "bar" };
  std::for_each(begin(c), end(c), [&fmt](const std::string& x)
                                  { fmt % x; });

Where V would indicate a variable list and the character constant
immediately after it would be the separator. (I'm not sure about V as a
parameter, but someone more familiar with the library might have an
answer to that.)

Alternatively, suggestions for a flexible container pretty printer would
be welcome as well.

Philipp Moeller

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at