I was wondering if below code has any difference between #1, #2 and #3 when passing a string to a function (eg. insert into a vector). Especially when dealing with millions of strings in the code.
std::vector<std::string> v;
std::string s("foo");
int i = 1;
v.push_back( s + "bar" + boost::lexical_cast<std::string>(i) ); // #1
v.push_back( std::string(s + "bar" + boost::lexical_cast<std::string>(i)) ); // #2
std::string s2 = s + "bar" + boost::lexical_cast<std::string>(i);
v.push_back(s2); // #3