Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-05-28 22:55:48


What should this program print?

   boost::regex r("(a)");
   std::cout << r.mark_count();

My tests show "2". I think the answer should be "1". I see this
resolution to TR1 issue 7.22:

> 7.53 Resolution to DR 7.22 was incomplete
> Submitter: John Maddock
> Status: TR
> The changes made to solve issue 7.22 were incomplete, specifically:
> p175 section 7.11.1, table 7.16: the entry for m.size() should read:
> 1 + e.mark_count()
> This was addressed in issue 7.22, but we missed the fact that this table also has to change to
> match the change for match_results::size().

If match_results::size() should return regex::mark_count() + 1, then
that seems to suggest that regex::mark_count() should return the number
of captures, *not including the 0th capture*. Is my reading correct? If
so, Boost.Regex is not compliant.

FWIW, xpressive reports that the regex "(a)" has a mark_count of 1.
Inconsistency == bad. :-(

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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