|
Boost : |
Subject: Re: [boost] [program_options]
From: Phil Richards (news_at_[hidden])
Date: 2010-03-07 05:13:24
On Sun, 2010-03-07 at 09:25 +0300, Vladimir Prus wrote:
> > From: "Phil Richards" <news_at_[hidden]>
> >> 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_at_[hidden]>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk