www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4408] New: Ambiguity when using std.algorithm.splitter with generic ranges

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4408

           Summary: Ambiguity when using std.algorithm.splitter with
                    generic ranges
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com


--- Comment #0 from David Simcha <dsimcha yahoo.com> 2010-06-29 19:11:19 PDT ---
import std.algorithm;

struct Range {
    int[] nums = [1,2,3,4,5,6,7,8,9,10];

     property int front() {
        return nums[0];
    }

    void popFront() {
        nums = nums[1..$];
    }

     property bool empty() {
        return nums.length == 0;
    }

     property typeof(this) save() {
        return this;
    }
}

void main() {
    Range r;
    auto split = splitter(r, 5);
}

d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(845): Error: template
instance Splitter!(Range,int) matches more than one template declaration,
d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(790):Splitter(Range,Separator)
if (is(typeof(ElementType!(Range).init == Separator.init))) and
d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1044):Splitter(alias
isTerminator,Range,Slice =
Select!(is(typeof(Range.init[0..1])),Range,ElementType!(Range)[]))
d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(846): Error:
Splitter!(Range,int) is used as a type
d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(852): Error: function
expected before (), not void of type void
d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(25): Error: template
instance std.algorithm.splitter!(Range,int) error instantiating
test9.d(25): Error: variable test9.main.split voids have no value
test9.d(25): Error: expression splitter(r,5) is void and has no value

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 29 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4408


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 29 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4408


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #1 from David Simcha <dsimcha yahoo.com> 2010-08-16 19:57:13 PDT ---
Fixed SVN.

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