Possible Duplicate:
Global const string& smells bad to me, is it truly safe?
I've stumbled across the following code and wondered of its merits
std::string const & thestring( "XYZ" );
It's the fact that it's constructing the object and referring to it by a reference. I'm used to seeing
std::string const theString( "XYZ" );
and was wondering what the difference was. I'm reasonably happy that the object wouldn't be destructed early as the object lives on the stack along with the reference.