Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-06-15 14:21:49


Marty Eaves wrote:
> I am having an issue using the regex library. I am developing in VC7
> and this issue occurs with both Boost 1.33.0 and 1.33.1. I have
> recently tried to start retrieving capture information in the regex
> matches by using the match_result and sub_match classes. In order to
> use these classes, the compile flag BOOST_REGEX_MATCH_EXTRA is
> required
> to be turned on (enabled in user.hpp). With the library is built with
> this flag on, I will get the following trap when the method calling
> regex_match() returns.

Just a clarification: you only need that define if you want extended capture
information. You can access regular Perl style marked sub-expressions
perfectly well without it.

> An unhandled exception of type 'System.NullReferenceException'
> occurred
> in tg12.exe
>
>
>
> Additional information: Object reference not set to an instance of an
> object
>
>
>
> This exception appears to occur in the cleanup logic of the
> ~match_results() destructor. I have yet to make any changes to the
> code
> to use the match_results object. In other words, the code I am using
> worked previously without the BOOST_REGEX_MATCH_EXTRA flag enabled.
> Are
> there any compiler options required?

No none, if I'm reading your stack trace right it's std::vector that's
causing the failure: there's nothing fancy going on inside sub_match just a
scoped_ptr to a vector or sub_matches. Do you have a test case I can look
at? If you're using managed code (looks like you are?) you might want to
double check to see if there are any known issues using that with the STL.

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