Boost logo

Boost Users :

From: Andreas Sedlmeier (sedlmeier_at_[hidden])
Date: 2007-05-25 09:12:03


Hi.

I am a relative newbie to two things:
- Boost C++ libraries
- Working with the standard C++ libraries
and this is my first post on this list.
Hello to everyone - I hope you'll forgive me if following question is
simply stupid.
I cant't even tell that.

I currently need to wrap some of the functionality string algorithms
and Boost.Regexp offers in Windows DLLs; the developemnt environment I
use is VS2005.

I started with the samples given in string algorithms which offer a
different interface to some of the Boost.Regexp library.

I slightly modified the sample and basically now have something like this:

using namespace std;
using namespace boost;

string strInput ("abc__(456)__123__(123)__cde");
regex expression = "[0-9]+"
string strReplaceWith("#$1#")
string strResult = replace_all_regex_copy(str, expression, strReplaceWith );

This certainly does not make that much sense; its however user input I
need to cope with and my problem is that I get an unhandled exception
here which I cannot catch.

Failure is exactly here (regex_format.hpp):
template <class OutputIterator, class Results, class traits>
void basic_regex_formatter<OutputIterator, Results, traits>::put(const
sub_match_type& sub)
{
   typedef typename sub_match_type::iterator iterator_type;
   iterator_type i = sub.first;
   while(i != sub.second)
   {
      put(*i);
      ++i;
   }
}

in the line "while(i != sub.second)"

I saw that the MS standard C++ libraries compares the iterator types
here. And, maybe because in my sample both - i and sub.second - are
NULL here, it asserts with "string iterators incompatible".

Does anybody know how to solve this problem ? Am I doing something
completely wrong or is this maybe a incompatibility of Boost C++ with
the MS standard C++ library and other compilers would behave different
for my sample ?

Any help or insight greatly appreciated.

Andreas.


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