[Issue 4367] std.regex: Captures is not a random access range

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 22 08:50:03 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4367



--- Comment #2 from Graham Fawcett <graham.fawcett at gmail.com> 2010-06-22 08:50:01 PDT ---
Hm, did my patch implement 'back' correctly? It's not clear to me
whether it should be this:

  return input[matches[$-1].startIdx .. matches[$-1].endIdx];

(as in my patch), or this:

  size_t end = length - 1;
  return input[matches[end].startIdx .. matches[end].endIdx];

The question arises from the definition of length():

  @property size_t length()
  {
      foreach (i; 0 .. matches.length)
      {
          if (matches[i].startIdx >= input.length) return i;
      }
      return matches.length;
  }

So should back() use length() as a limit, or should it return the last
element of matches?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list