Boost logo

Boost Users :

From: John Maddock (john_maddock_at_[hidden])
Date: 2002-10-13 05:25:37


> I've been using regex 3.20 with g++ 2.95.3 with no problems. We're in the
> process of moving towards g++ 3.1.1 (we have a library we need to use and
it
> core dumps with 2.95.3 due to a bug in the stdc++ that goes with it in
> ofstream).
>
> So, I have g++ 3.1.1 working fine in redhat 6.2. I couldn't find the regex
> standalone library so I ended up downloading the whole boost suite
(1_29_0)
> and I built only the regex++ library.
>
> I have one comment regarding this version (which I don't know what it is
> BTW. What's the version of regex++ in boost 1_29_0?, I guess it's 3.31).

The separate regex version number has been removed it's just boost-1.29.0
now.

> It seems that boost:cmatch doesn't work anymore when doing a regex_search,
I
> ended up modifying boost:cmatch with
> boost::match_results<std::string::const_iterator>, I hope that's ok.

That's because you should only use cmatch with C strings (const char*), use
boost::smatch with std::string's, that's what it's there for.

> I'm also having some trouble compiling some code but this is a problem
with
> the new STL implementation that ships with g++ 3.1.1 (the v3 STL). I can't
> seem to find the solution, that's why I'm asking here, if anybody has any
> pointers I'll be very grateful.
>
> Look at what I get:
>
>
> And the code it complains about is this:

Your code is buggy, see fixes below:

>
> static void findSopInstances( IDB_HANDLE** idbHandle,
> const std::vector<CommitSopInfo>& rSopList,
> std::vector<CommitSopInfo>& rSuccesses,
> std::vector<CommitSopInfo>& rFailures )
> {
> static const char * func = "(findSopInstances)";
>
> // Iterate over list of SOP instances
// this line is buggy, you are trying to convert a const-iterator to an
iterator, it should be:
+ for ( std::vector<const CommitSopInfo>::const_iterator pos =
rSopList.begin();
> for ( std::vector<const CommitSopInfo>::iterator pos =
rSopList.begin();
> pos < rSopList.end(); pos++ )
> {
>
> // Test whether we have this instance
// bug: an iterator is not a pointer, this should be:
+ if ( haveSopInstance( idbHandle, &(*pos) ) )
> if ( haveSopInstance( idbHandle, pos ) )
> {
> ......
>
>
> Where haveSopInstance is defined as:
>
> static bool haveSopInstance( IDB_HANDLE** idbHandle,
> const CommitSopInfo* pSopInfo )
> {
>
> now, this used to compile fine under g++2.95.3 with its stdc++. I don't
see
> why it's having difficuly converting the interator to the CommitSopInfo*.

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm


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