Boost logo

Boost :

Subject: Re: [boost] boost::algorithm::trim_copy() behaves like "strdup" innormal C, does it allocate a new string ?
From: gf (g.fanini_at_[hidden])
Date: 2012-03-11 18:00:48

I found the leaks were elsewhere, nothing to do with trim_copy, it seem to
me from you explanations that this sort of invocation :

std::string s;

is equivalent to doing :

i.e. it is allocated on the stack and is automatically deallocated when
going out of scope

<g.fanini_at_[hidden]> ha scritto nel messaggio
> 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 ?
> It is not entirely clear from the documentation :
> Because the argument passed has the modifier "const" I am led to believe
> it would leave the passed string unchanged, and return a newly allocated
> string. Possibly would you consider kindly updating the documentation
> reflecting the returned string is newly allocated.I am asking this
> becauseI am trying to work with preexisting boost code which uses
> boost::algorithm::trim_copy() profusely and I have severe leakage
> problems.Thank you for any information.
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at