Skip to content

Commit

Permalink
Improve Lockstep docs.
Browse files Browse the repository at this point in the history
Remove stray // from generated docs.

Reorder that example to flow better with the preceding prose.

Fix coding style in code examples.
  • Loading branch information
H. S. Teoh committed Jul 20, 2015
1 parent 0371681 commit e21c9a5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions std/range/package.d
Expand Up @@ -3968,17 +3968,17 @@ private string lockstepMixin(Ranges...)(bool withIndex)
By default $(D StoppingPolicy) is set to $(D StoppingPolicy.shortest).
BUGS: If a range does not offer lvalue access, but $(D ref) is used in the
$(D foreach) loop, it will be silently accepted but any modifications
to the variable will not be propagated to the underlying range.
// Lockstep also supports iterating with an index variable:
Example:
Lockstep also supports iterating with an index variable:
-------
foreach(index, a, b; lockstep(arr1, arr2)) {
foreach (index, a, b; lockstep(arr1, arr2))
{
writefln("Index %s: a = %s, b = %s", index, a, b);
}
-------
BUGS: If a range does not offer lvalue access, but $(D ref) is used in the
$(D foreach) loop, it will be silently accepted but any modifications
to the variable will not be propagated to the underlying range.
*/
struct Lockstep(Ranges...)
if (Ranges.length > 1 && allSatisfy!(isInputRange, Ranges))
Expand Down Expand Up @@ -4031,7 +4031,7 @@ unittest
auto arr1 = [1,2,3,4,5];
auto arr2 = [6,7,8,9,10];

foreach(ref a, ref b; lockstep(arr1, arr2))
foreach (ref a, ref b; lockstep(arr1, arr2))
{
a += b;
}
Expand Down

0 comments on commit e21c9a5

Please sign in to comment.