[Boost-bugs] [Boost C++ Libraries] #3941: match_results relies on string evaluated by regex_search()

Subject: [Boost-bugs] [Boost C++ Libraries] #3941: match_results relies on string evaluated by regex_search()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-02-17 18:46:15


#3941: match_results relies on string evaluated by regex_search()
---------------------------------------------+------------------------------
 Reporter: David Klamet <davek@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: regex
  Version: Boost 1.40.0 | Severity: Optimization
 Keywords: |
---------------------------------------------+------------------------------
 See example:
 If "text" is altered or destroyed, "matches" becomes invalid.
 Is this the desired behavior?
 -----------------------


     string pattern="^\\s*:(\\S+)\\s*";
     string text=" :command ";

     boost::regex re(pattern);


     boost::match_results<string::const_iterator> matches;
     bool stat=boost::regex_search(text, matches, re);
     text=""; //Truncate string
     cout<<matches[1].str()<<endl; //<<Throws sting iterator not
 dereferencable exception

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