foreach over pointers OR foreach that mutates the iterator
guest via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jan 26 04:03:39 PST 2017
On Thursday, 26 January 2017 at 11:32:09 UTC, ZombineDev wrote:
>
> Not sure if this is a bug in isInputRange or foreach, but they
> should work consistently.
Copy/paste from primitives.d:
template isInputRange(R)
{
enum bool isInputRange = is(typeof(
(inout int = 0)
{
R r = R.init; // can define a range object
if (r.empty) {} // can test for empty
r.popFront; // can invoke popFront()
auto h = r.front; // can get the front of the range
}));
}
More information about the Digitalmars-d
mailing list