How to create / combine / concatenate boost::format from multiple boost::format

534 Views Asked by At

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?

1

There are 1 best solutions below

0
vitaut On BEST ANSWER

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.