Opened 12 years ago

Closed 12 years ago

#4708 closed Bugs (fixed)

regex::sub_match::length()

Reported by: robin.snyder@… Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.44.0 Severity: Problem
Keywords: regex sub_match length Cc:

Description

code does not match documentation. if matched==false length() does not return 0, instead it results in an assertion of "string iterators incompatible" docs state:

static difference_type length();

Effects: returns the length of this matched sub-expression, or 0 if this sub-expression was not matched: matched ? distance(first, second) : 0). 

Checked the source, code is broke.

Change History (4)

comment:1 by robin.snyder@…, 12 years ago

Keywords: regex sub_match length added
Summary: reges::sub_match::length()regex::sub_match::length()

comment:2 by robin.snyder@…, 12 years ago

this also affects the .str() method. if you call matchmissing.str() and there is no such named group, it fails with the same assert.

comment:3 by John Maddock, 12 years ago

Confirmed, testing fix now...

comment:4 by John Maddock, 12 years ago

Resolution: fixed
Status: newclosed

(In [65800]) Stop accessing/comparing singular iterators. Fixes #4708.

Note: See TracTickets for help on using tickets.