std::string val = "hello world";
int p = 100500;
std::string result = '[' % val % " : " % p % ']';
#include <boost/format.hpp>
#include <iostream>
int main() {
std::string val = "hello world";
boost::format f("[%s : %i]");
int p = 100500;
std::cout << boost::str(f % val % p) << std::endl;
std::cout << boost::str(f % val % (p - 1)) << std::endl; //Can be reused
std::cout << boost::str(boost::format("Hello, %s!") % "@Taraflex") << std::endl; //Can be initialized in place
return 0;
}