Re: [Boost-bugs] [Boost C++ Libraries] #1749: regex_match on filesystem iterator.leaf () leads to strange results in what[]

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1749: regex_match on filesystem iterator.leaf () leads to strange results in what[]
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-04-04 12:54:12


#1749: regex_match on filesystem iterator.leaf () leads to strange results in
what[]
------------------------------------------+---------------------------------
  Reporter: christopher.lang_at_[hidden] | Owner: johnmaddock
      Type: Bugs | Status: closed
 Milestone: | Component: regex
   Version: | Severity: Problem
Resolution: invalid | Keywords: filesystem path iterator
------------------------------------------+---------------------------------
Changes (by johnmaddock):

  * status: new => closed
  * resolution: => invalid

Comment:

 The problem here is that the leaf() function returns a *temporary string
 value*, so by the time that regex_match returns the string matched against
 has gone out of scope, and the iterators stored in match_results<> have
 all been invalidated. Assigning the result of leaf() to a local string
 object before calling regex_match will fix this.

 HTH, John Maddock.

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1749#comment:1>
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:49:57 UTC