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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 22 06:12:48 PDT 2010


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

           Summary: std.regex: Captures is not a random access range
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: graham.fawcett at gmail.com


--- Comment #0 from Graham Fawcett <graham.fawcett at gmail.com> 2010-06-22 06:12:47 PDT ---
>From the std.regex documentation:

"Captures captures(). Retrieve the captured parenthesized matches, 
in the form of a random-access range."

The Captures struct is not a random access range, because it is not a
forward range. The following test program fails to compile:

import std.regex;
import std.range;

void main() {
  auto c = match("hello", "[aeiou]").captures;
  alias typeof(c) C;
  static assert (isInputRange!C);   // pass
  static assert (isForwardRange!C); // failure
  static assert (isBidirectionalRange!C);
  static assert (isRandomAccessRange!C);
}

-- 
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