std:string 的有关问题,新手请问。多多帮忙

std::string 的问题,新手请教。多多帮忙。
问题是这样的关于 
Cstring d;
int i = 123;
d.format("this is my code : %d",i);
printf("%s",d);
但是用 std::string 

我该如何像cstring 那样格式化成一句话。




------解决方案--------------------
C/C++ code

#include <sstream>
...

stringstream ss;
int i = 123;
ss << "this is my code : " << i;
printf("%s",ss.str());