JRR
JRR

Reputation: 6152

what is the cleanest way to concat a const char * with a string in c++?

I am aware that I can use a stringstream but I am hoping that there is a simpler way to write "hello" + a_std_string_object .

Upvotes: 0

Views: 209

Answers (1)

pdw
pdw

Reputation: 8866

If you have an old/broken compiler it might require

string("hello") + std_string_object

but in modern compilers the natural code

"hello" + std_string_object

should work.

Upvotes: 4

Related Questions