Bug 4363 – Some phobos ranges are not forward ranges (but should be)
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-06-22T01:56:00Z
Last change time
2010-08-14T21:05:03Z
Assigned to
nobody
Creator
philippe.sigaud
Comments
Comment #0 by philippe.sigaud — 2010-06-22T01:56:46Z
As of 2.047, to be a forward range one has to have a .save() method.
std.algorithm.Until does not have one, but should be a forward range.
Comment #1 by yebblies — 2010-06-22T23:57:03Z
I've also noticed randomCover has the same problem. Maybe rather than create a separate bug report this one could list the ranges in phobos that need a '@property typeof(this) save() { return this; }' added?
Comment #2 by philippe.sigaud — 2010-06-23T12:43:43Z
(In reply to comment #1)
Yeah, I meant to scan std.algo but one of my daughters got sick and... well.
You could list other ranges that have the same problem, but in this case I need to change the bug report's title.
...
OK, done. Go wild.
Comment #3 by yebblies — 2010-06-23T22:15:25Z
std.numeric: GapWeightedSimilarityIncremental
std.random: LinearCongruentialEngine, MersenneTwisterEngine, RandomCover, RandomSample
std.range: Radial, Repeat, Cycle, Recurrence, FrontTransversal, Transversal
std.regex: Regex
std.regexp: Splitter
std.algorithm: Filter, Splitter, Uniq, Group, Until, SetUnion, SetIntersection, SetDifference, SetSymmetricDifference
std.container: SList(T).Range
This list is of any structs that define popFront and do not define save, and seem to support copying. I've excluded any types with allocated storage, unless they define a copy constructor. I've also excluded any that are obviously designed to be input ranges (have a File handle etc) but a couple may have slipped through.
Comment #4 by yebblies — 2010-06-23T22:18:24Z
Changed the title to reflect that this report covers all of phobos, not just std.algorithm.
Comment #5 by yebblies — 2010-06-24T01:54:48Z
According to David Simcha's commcent in bug 4362, repeat and cycle have already been fixed in svn. This leaves:
std.numeric: GapWeightedSimilarityIncremental
std.random: LinearCongruentialEngine, MersenneTwisterEngine, RandomCover,
RandomSample
std.range: Radial, Recurrence, FrontTransversal, Transversal
std.regex: Regex
std.regexp: Splitter
std.algorithm: Filter, Splitter, Uniq, Group, Until, SetUnion, SetIntersection,
SetDifference, SetSymmetricDifference
std.container: SList(T).Range
Comment #6 by yebblies — 2010-07-15T19:40:15Z
*** Issue 4467 has been marked as a duplicate of this issue. ***