Skip to content

Commit

Permalink
Rework qualifiers in Cycle!Array
Browse files Browse the repository at this point in the history
  • Loading branch information
monarchdodra committed Jan 5, 2014
1 parent cab8c65 commit a8177b8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions std/range.d
Expand Up @@ -4420,20 +4420,21 @@ struct Cycle(R)
private ElementType* _ptr;
private size_t _index;

nothrow:
this(ref R input, size_t index = 0)
{
_ptr = input.ptr;
_index = index;
}

@property auto ref inout(ElementType) front() inout
@property ref inout(ElementType) front() inout
{
return _ptr[_index % R.length];
}

enum bool empty = false;

void popFront()
void popFront() nothrow

This comment has been minimized.

Copy link
@vsn4ik

vsn4ik Jan 6, 2014

Already nothrow (line 4423).

This comment has been minimized.

Copy link
@monarchdodra

monarchdodra Jan 6, 2014

Author Collaborator

Oops. Missed that. Thanks.

{
++_index;
}
Expand All @@ -4443,7 +4444,7 @@ struct Cycle(R)
return _ptr[(n + _index) % R.length];
}

@property Cycle save()
@property inout(Cycle) save() inout
{
return this;
}
Expand All @@ -4462,7 +4463,7 @@ struct Cycle(R)
return this[i .. $].takeExactly(j - i);
}

auto opSlice(size_t i, DollarToken)
auto opSlice(size_t i, DollarToken) inout
{
return typeof(this)(*cast(R*)_ptr, _index + i);
}
Expand Down

0 comments on commit a8177b8

Please sign in to comment.