Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-11-10 06:04:36

> We have the following piece of code that uses boost (copy/paste):

I'm afraid I don't have a copy of 1.31 lying around anymore, but your
problems are almost certainly allocator related. Can you remove the
allocator related code? As it stands your code doesn't actually "do"
anything. Or or you actually using a custom allocator?

As for the HP aCC problem: it's very similar to one that occurs with VC7
when there's a "using namespace std;" declaration before including regex:
the compiler is then unable to differentiate between std::collate (the
template) and boost::collate (the constant), and it's a compiler bug.
Otherwise your workaround is as good as any I guess.

Are you in a position to upgrade to Boost-1.33.1 ?

The bad news is that your code as it stands will likely need some porting to
make the change (reg_expression has been deprecated in favour of basic_regex
for example, but the typedefs like boost::regex boost::wregex etc are all
the same). The good news is that the regex matching code has been
substantially re-written to be much faster, and hardly does any memory
allocation at all (or even none at all under ideal conditions), so custom
allocators are very much a thing of the past.

It would simplify your code to:

#include "boost/regex.hpp"

using namespace boost;
using namespace std;

typedef boost::regex re_type;

long example_func(long pos, const std::string& regE, long& reslen, long
  long res;
  boost::match_results <PData::iterator> m;

  re_type e;

  e.assign (regE, regbase::normal);

  if (regex_search (begin (), end (), m, e, match_not_dot_newline |
    res = pos + m.position();
    reslen = m.length();
    return res;

Sorry I can't be more helpful about this: diagnosing these kinds of deep
template instantiation errors are next to impossible sometimes, but are
almost always errors in the template argument list.

Hope this helps a little at least,


Boost list run by bdawes at, gregod at, cpdaniel at, john at