Boost logo

Boost :

From: christian.engstrom_at_[hidden]
Date: 2001-11-26 06:45:57


--- In boost_at_y..., christian.engstrom_at_g... wrote:
> The following program will not compile with Microsoft Visual C++
> version 6 for me:
>
>
> #include <boost/regex.hpp>
>
> void main() {
>
> char cstr[]("abcdef");
>
> boost::regex e("abc");
> boost::cmatch m;
>
> boost::regex_match(cstr, cstr + 3, m, e, boost::match_default);
> }
>
>
> The error message I get from the compiler is "error
> C2661: 'regex_match' : no overloaded function takes 5 parameters".
>
> I find this very odd, since both the documentation and the source
> code in regex_match.hpp seem to suggest (to me at least) that the 5
> parmeter variant of the call should always be available, even if
> some of the "convenience versions" of the call may not be.
>
> Is there something obvious that I have missed, or is this a problem
> related to the VC6 compiler? If the latter is the case, what is
> the best workaround?

Upon further investigation, the problem seems to be related to the
fact that 'cstr' in the example is not declared 'const'. If I change
the relevant declaration to

  const char cstr[]("abcdef");

the program will compile successfully.

Since there is no mention of this in the documentation, I would
consider this to be a bug in the regex package.

If there is anybody else but me who has actually tried to use the
iterator versions of the functions in the regex package, I would be
very interested in any comments that you may have that could shed
some light on this issue.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk