[Boost-bugs] [Boost C++ Libraries] #6034: Problem of the split function in boost/date_time/time_parsing.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #6034: Problem of the split function in boost/date_time/time_parsing.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-10-19 12:13:46


#6034: Problem of the split function in boost/date_time/time_parsing.hpp
------------------------------+---------------------------------------------
 Reporter: fbriol@… | Owner: az_sw_dude
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: date_time
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 If we call the function '''split''' with the string "2010-01-01" and " "
 as delimiter then the function sets the variables '''first''' and
 '''second''' with "2010-01-01"
 Maybe we should write this piece of code to initialize the parameter
 '''second''' with the correct value.


 {{{
 bool
   split(const std::string& s,
         char sep,
         std::string& first,
         std::string& second)
   {
     int sep_pos = static_cast<int>(s.find(sep));
     first = s.substr(0,sep_pos);
     second = sep_pos == -1 ? "" : s.substr(sep_pos+1);
     return true;
   }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6034>
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