https://d.puremagic.com/issues/show_bug.cgi?id=12188
--- Comment #1 from Peter Alexander <[email protected]> 2014-02-18 12:51:15 PST --- BTW, you may already know this, but it's impossible to solve this with the current range primitives. See the discussion here: http://www.digitalmars.com/d/archives/digitalmars/D/Retrieving_the_traversed_range_116085.html#N116085 To summarise the discussion: it is impossible currently, and Andrei recommends two approaches: 1. Just make it random access only for now. 2. Define a new primitive: allBefore, like this: R allBefore(R)(R all, R tail) if (isRandomAccessRange!R && hasLength!R) { // assume tail starts somewhere inside all and ends where all ends enforce(all.length >= tail.length); return all[0 .. all.length - tail.length); } R allBefore(R)(R all, R tail) if (isBidirectionalRange!R && is(typeof(all.allBeforeImpl(tail)) : R)) { return all.allBeforeImpl(tail); } And require that for nextPermutation -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
