Skip to content

Commit

Permalink
rework slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
monarchdodra committed Jan 5, 2014
1 parent 0230998 commit cab8c65
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions std/range.d
Expand Up @@ -4348,16 +4348,12 @@ struct Cycle(R)
}
body
{
auto retval = this.save;
retval._index += i;
return takeExactly(retval, j - i);
return this[i .. $].takeExactly(j - i);
}

auto opSlice(size_t i, DollarToken)
{
auto retval = this.save;
retval._index += i;
return retval;
return typeof(this)(_original, _index + i);
}
}
else
Expand Down Expand Up @@ -4463,16 +4459,12 @@ struct Cycle(R)
}
body
{
auto retval = this.save;
retval._index += i;
return takeExactly(retval, j - i);
return this[i .. $].takeExactly(j - i);
}

auto opSlice(size_t i, DollarToken)
{
auto retval = this.save;
retval._index += i;
return retval;
return typeof(this)(*cast(R*)_ptr, _index + i);
}
}

Expand Down

0 comments on commit cab8c65

Please sign in to comment.