Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions std/algorithm/comparison.d
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ Returns:
found value plus one is returned.

See_Also:
$(REF_ALTTEXT find, find, std,algorithm,searching) and $(REF_ALTTEXT canFind, canFind, std,algorithm,searching) for finding a value in a
range.
$(UL
$(LI $(REF_SHORT find, std,algorithm,searching) and
$(REF_SHORT canFind, std,algorithm,searching) for finding a value in a range.)
$(LI $(REF_ALTTEXT `value in iota(start, end)`, iota, std,range) to find a value in
a particular interval.)
)
*/
uint among(alias pred = (a, b) => a == b, Value, Values...)
(Value value, Values values)
Expand Down
12 changes: 8 additions & 4 deletions std/range/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -6847,12 +6847,15 @@ pure @safe nothrow unittest
user-defined types that support `++`, the range is an input
range.

An integral iota also supports `in` operator from the right. It takes
the stepping into account, the integral won't be considered
contained if it falls between two consecutive values of the range.
`contains` does the same as in, but from lefthand side.
$(DDOC_SECTION_H `in` operator and `contains`:)
`iota` over an integral/pointer type defines the `in` operator from the right.
`val in iota(...)` is true when `val` occurs in the range. When present, it takes
`step` into account - `val` won't be considered
contained if it falls between two consecutive elements of the range.
The `contains` method does the same as `in`, but from the left-hand side.

Example:
$(RUNNABLE_EXAMPLE
---
void main()
{
Expand All @@ -6879,6 +6882,7 @@ pure @safe nothrow unittest
writeln();
}
---
)
*/
auto iota(B, E, S)(B begin, E end, S step)
if ((isIntegral!(CommonType!(B, E)) || isPointer!(CommonType!(B, E)))
Expand Down
Loading