[Issue 10265] New: RandomSample fails when passed an InputRange as input
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 4 06:23:22 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10265
Summary: RandomSample fails when passed an InputRange as input
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: joseph.wakeling at webdrake.net
--- Comment #0 from Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> 2013-06-04 06:23:21 PDT ---
By design, RandomSample is supposed to operate on any InputRange:
struct RandomSample(R, Random = void)
if(isInputRange!R && (isUniformRNG!Random || is(Random == void)))
However, RandomSample itself is designed to be a ForwardRange with save()
defined. The save property in turn assumes that the input has save() defined:
@property typeof(this) save()
{
auto ret = this;
ret._input = _input.save;
return ret;
}
The assumption that RandomSample can have save() defined is also problematic
for a second reason: the output from the saved copy will depend on random
numbers, and therefore will not be identical, so it is not clear what the
benefit of a save() function is.
--
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