It should work even if you have two "constants" (which I assume you mean the name, name2, and profession) without a string between, as long as there is a + there.
The name and name2 are replaced with strings (the ones you have obviously stored in there earlier), and you're just concatenating strings together.
Use std::ostringstream rather than manipulating strings directly. You can directly write type as long as it has an std::ostream operator or is a built in type.