[Issue 4464] std.range.take does not always return Take!R

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 15 22:14:20 PST 2010


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


yebblies <yebblies at gmail.com> changed:

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


--- Comment #2 from yebblies <yebblies at gmail.com> 2010-12-15 22:12:30 PST ---
Unfortunately this has been broken again by:
http://www.dsource.org/projects/phobos/changeset/2102
(http://d.puremagic.com/issues/show_bug.cgi?id=5052)
which added a new overload for 'take' but does not add a corresponding 'Take'
template.

Patch:

Change the template constraint on the main Take range to match the main take
function, and add a 'Take' template for the Take!Take!R case.


range.d:2074
- if(isInputRange!(Unqual!Range) &&
- (!hasSlicing!(Unqual!Range) || isNarrowString!(Unqual!Range)))
+ if((isInputRange!(Unqual!Range) && (!hasSlicing!(Unqual!Range) ||
isNarrowString!(Unqual!Range)))
+     && !is (Range T == Take!T))


+ // For the simplified Take!Take!R case
+ 
+ template Take(R)
+ if((isInputRange!(Unqual!R) && (!hasSlicing!(Unqual!R) ||
isNarrowString!(Unqual!R)))
+    && is (R T == Take!T))
+ {
+     alias R Take;
+ }

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