[Boost-bugs] [Boost C++ Libraries] #5915: boost::split replaces original data

Subject: [Boost-bugs] [Boost C++ Libraries] #5915: boost::split replaces original data
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-09-19 19:25:12


#5915: boost::split replaces original data
--------------------------------+-------------------------------------------
 Reporter: mathstuf@… | Owner: pavol_droba
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: string_algo
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
--------------------------------+-------------------------------------------
 Pseudo-ish code:

 <code>
 std::vector<std::string> nodes;
 nodes.push_back("z");
 boost::split(nodes, "a:b:c", ':');
 </code>

 After this, "z" is no longer a member of nodes due to a std::swap in
 iter_split. Result.insert(Result.end(), itBegin, itEnd) (or some
 equivalent) should probably be done instead. The docs state:

 "Each part is copied and added as a new element to the output container."

 Either the docs are incorrect or the code needs fixed.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5915>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC