[Issue 5226] New: indexOf() which takes a pred but no needle

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 16 16:23:29 PST 2010


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

           Summary: indexOf() which takes a pred but no needle
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2010-11-16 16:22:17 PST ---
Currently, std.algorithm has an indexOf() function which takes an optional
predicate (as a template parameter), a range, and a needle. I think that we
should have a version that takes the predicate and a range but no needle, using
only the predicate to find the index that you're looking for. In many ways,
indexOf() is indentical to find() in terms of what it's for except that find()
returns the remainder of the range and indexOf() returns where in the range
what you're trying to find is, so indexOf()'s flexibility should be closer to
find()'s (except insomuch as differences in the range types that they take
affect them).

In any case, a version of indexOf() which takes no needle but just the
predicate and the range would be a very useful addition to Phobos.

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