Create inline std::string

Viewed 3195

Is it possible to initialize a std::string without creating a variable?

What I wish to accomplish:

throw std::runtime_error("Error: " + strerror(errno));

What I do currently:

std::string error = "Error: ";
std::string errmsg(strerror(errno));
throw std::runtime_error(error + errmsg);
1 Answers
Related