
On Sun, 2010-03-07 at 09:25 +0300, Vladimir Prus wrote:
From: "Phil Richards" <news@derived-software.ltd.uk>
I can't see how taking a std::string const& as an argument has any detrimental effect on conversions or code bloat. The std::string version of set_name would just remove the first line of the function (creating the temporary "name"), and use _name throughout the function body. Sorry, you have said 'replace' -- which means changing const char* to std::string (const, &, whatever). That would meant creating a string at each call site where you pass const char*, which is more code than required to just push pointer to the stack.
Well, OK, if you are concerned about overheads at that level, on a piece of code that is generally going to be invoked once immediately after program start-up, then I don't think I've got any counter-argument. I just can't actually see that it is a big issue, but there are obviously use-cases where it must be. So I'll withdraw "replace" and say "additionally". Phil -- Phil Richards, <news@derived-software.ltd.uk>