3

This is given:

boost::format greeting("%s (Greeting)");
boost::format name("%s (Name)");

'greetingwithname' should combine and reuses 'greeting' and 'name' so that it is equivalent to this:

boost::format greetingwithname("%s (Greeting) %s (Name)");
// looking for solution to like boost::format greetingwithname = greeting + name;

How do I / What is the best way to create a boost::format object from multiple boost:format objects?

ToBe
  • 921
  • 1
  • 9
  • 23
  • It's not an option and AFAICT it's not implementable from the public interface. Cheap solution: concatenate the format strings instead of the formatter objects. – sehe Mar 05 '15 at 07:39
  • Thanks. Yes, if there is no easy solution I will work with the std::string and apply the final result to the formatter. – ToBe Mar 16 '15 at 09:38

1 Answers1

0

It is not possible to concatenate the boost::format objects, but as @sehe commented you can concatenate the format strings instead and create a format object from that.

vitaut
  • 49,672
  • 25
  • 199
  • 336