On 05/30/2010 01:39 AM, Philippe Sigaud wrote:
On Sat, May 29, 2010 at 23:17, Andrei Alexandrescu <[email protected] <mailto:[email protected]>> wrote:There's a tacit rule that has r.opSlice(a, b) return the same type as r itself. I'm not sure if take does that already, but it should simply morph into opSlice() if opSlice() is available. No need to use another layer when opSlice does what you need. No, it does not do that already. OK, I'm a pain, but what if the range does not know its length? How do you know if r[0..n] is OK?
Just like every other range in std.range, you support various primitives depending on what your wrapped range supports. Per your question, in this case, if the range doesn't know its length but does support r[0 .. n], you conservatively wrap it with Take.
But I have to say that would be a pretty bizarre range. Andrei _______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
