|
Boost : |
From: Paul A. Bristow (boost_at_[hidden])
Date: 2003-10-25 15:20:12
| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]]On Behalf Of Pavol Droba
| Sent: Friday, October 24, 2003 3:31 PM
| To: Boost mailing list
| Subject: Re: [boost] Re: string algorithms review
| > 2 The suffix should be _copy and _copyto.
|
| Why? Could you plese provide rationale for this.
|
Because it is shorter and if the code is trim_copyto(s) is reads as though the
'to' means it goes to s.
(Of course, a rational language would specify in, out, or in&out but I won't
stir that hornets nest again!)
But actually I really rather like Rob Stewart's trimmed' suggestion.
Both
std::string t(trimmed(s));
or even if t already exists (poor but what novice and ex-C programmers may do)
t = trimmed(s)
seems to me to imply that nothing is done to s.
But to_uppered(s) or uppered is not so nice, but still just OK?
And what about concatentation t += trimmed(s);
and addition string full_name = trimmed(forename) + substr( trimmed(surname); ?
Since we already have protection against misuse,
this seems quite attractive to me.
Paul
Paul A Bristow, Prizet Farmhouse, Kendal, Cumbria, LA8 8AB UK
+44 1539 561830 Mobile +44 7714 33 02 04
mailto:pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk