Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-02-28 12:10:20


Diego Molla wrote:
> Hi,
>
> I have a problem using the Boost regex library. I have isolated the
> problem to the attached piece of code. For some reason the output
> returned by the function that uses regex is garbage. I have tested
> the same program on a Linux version of boost and it works fine. I
> wonder if the problem is on the Windows installation. Could someone
> using Windows or Cygwin test this and tell me if it works?

There's at least one issue with your code, in:

if (regex_search(what[1].str(),what,attrMarkup)) {

the result of what[1].str() is a temporary string object: by the time the
call returns the object has gone out of scope, and the iterators stored in
"what" are invalid.

HTH, John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net