|
Boost : |
Subject: Re: [boost] boost::algorithm::trim_copy() behaves like "strdup" in normal C, does it allocate a new string ?
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-03-10 07:58:22
On Sat, Mar 10, 2012 at 12:19 PM, Lars Viklund <zao_at_[hidden]> wrote:
> On Fri, Mar 09, 2012 at 07:14:24PM +0100, g.fanini_at_[hidden] wrote:
>> Could I ask for a clarification whether boost::algorithm::trim_copy()
>> behaves like "strdup" in normal C, i.e. does it allocate a new string ? or
>> does it modify the passed string without allocating a new string ?
>
> As the parameter is const, it cannot cast the const away to mutate it
> unless it knows things about the argument at the call site, which it
> cannot know.
Hmm, wouldn't a by-value parameter allow one to avoid the copy?
> Also, you're using very ancient documentation there, are you really on
> 1.34 or just using the wrong documentation?
It's still the first hit on google...
-- Olaf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk