Boost logo

Boost :

Subject: [boost] boost::algorithm::trim_copy() behaves like "strdup" in normal C, does it allocate a new string ?
From: g.fanini_at_[hidden]
Date: 2012-03-09 13:14:24


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.


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