On Tuesday, 17 November 2015 at 11:58:22 UTC, Chris wrote:
Sorry that should be:
@property void popFront()
{
r = r[1..$];
cnt++;
}
On Tuesday, 17 November 2015 at 12:41:45 UTC, Chris wrote:
On Tuesday, 17 November 2015 at 12:22:22 UTC, Marc Schütz wrote:
In any case, I'd suggest you fix your opIndex(), except if
there's a really good reason it is as it is.
I see. Thanks for the explanation. What would be the easiest
fix
I've checked several options now and it doesn't work.
Here (http://dlang.org/statement.html#foreach-with-ranges) it is
stated that it suffices to have range primitives, if opApply
doesn't exist. My code worked up to 2.068.0, with the
introduction of 2.068.1 it failed. I wonder why that is.
:
Updating my code from 2.067.1 to 2.069.1 (I skipped 2.068,
because I was too busy).
I get this error:
invalid foreach aggregate, define opApply(), range
primitives, or use .tupleof
for code like
foreach (ref it; myArray.doSomething) {}
Probably not the best idea anyway. What's the best
On Tuesday, 17 November 2015 at 11:58:22 UTC, Chris wrote:
I did just that and I could find the culprit. It's opIndex().
It works up until 2.068.0, with 2.068.1 I already get this
error:
"primitives.d(7): Error: invalid foreach aggregate
doSomething(items).opIndex()"
@prope
On Tuesday, 17 November 2015 at 12:22:22 UTC, Marc Schütz wrote:
Ok, that's a strange implementation of opIndex(). Usually, a
parameter-less opIndex() is supposed to return a slice into the
full range, but yours returns a size_t, which of course can't
be iterated over.
The change that made
already get this error:
"primitives.d(7): Error: invalid foreach aggregate
doSomething(items).opIndex()"
Here's the example:
=
import std.stdio : writeln;
import std.range.primitives;
void main()
{
string[] items = ["a", "
On Monday, 16 November 2015 at 16:44:27 UTC, Chris wrote:
Updating my code from 2.067.1 to 2.069.1 (I skipped 2.068,
because I was too busy).
I get this error:
invalid foreach aggregate, define opApply(), range primitives,
or use .tupleof
for code like
foreach (ref it; myArray.doSomething
On Monday, 16 November 2015 at 16:49:19 UTC, Marc Schütz wrote:
On Monday, 16 November 2015 at 16:44:27 UTC, Chris wrote:
Updating my code from 2.067.1 to 2.069.1 (I skipped 2.068,
because I was too busy).
I get this error:
invalid foreach aggregate, define opApply(), range primitives
Updating my code from 2.067.1 to 2.069.1 (I skipped 2.068,
because I was too busy).
I get this error:
invalid foreach aggregate, define opApply(), range primitives, or
use .tupleof
for code like
foreach (ref it; myArray.doSomething) {}
Probably not the best idea anyway. What's the best
foreach aggregate, define opApply(), range
primitives, or use .tupleof
for code like
foreach (ref it; myArray.doSomething) {}
Probably not the best idea anyway. What's the best fix for
this? Thanks.
Well, what does `doSomething` return?
It returns a range that modifies individual items
,
because I was too busy).
I get this error:
invalid foreach aggregate, define opApply(), range
primitives, or use .tupleof
for code like
foreach (ref it; myArray.doSomething) {}
Probably not the best idea anyway. What's the best fix for
this? Thanks.
Well, what does `doSomething` return
12 matches
Mail list logo