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;
trim_copy(s);

is equivalent to doing :
string(s);

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
news:0D047ED74D81417AA3AB1834F4ED4254_at_onetech2...
> 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 :
> http://www.boost.org/doc/libs/1_34_0/doc/html/boost/algorithm/trim_copy.html
> 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:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk