mirror of
https://github.com/dlang/phobos.git
synced 2025-05-04 17:11:26 +03:00
std.algorithm: improve documentation of filter (#8514)
std.algorithm: improve documentation of filter Signed-off-by: Razvan Nitu <RazvanN7@users.noreply.github.com> Merged-on-behalf-of: Petar Kirov <PetarKirov@users.noreply.github.com>
This commit is contained in:
parent
218512dc95
commit
4d0e74ba1c
1 changed files with 9 additions and 6 deletions
|
@ -1263,19 +1263,22 @@ public:
|
||||||
|
|
||||||
// filter
|
// filter
|
||||||
/**
|
/**
|
||||||
Implements the higher order filter function. The predicate is passed to
|
`filter!(predicate)(range)` returns a new range containing only elements `x` in `range` for
|
||||||
$(REF unaryFun, std,functional), and can either accept a string, or any callable
|
which `predicate(x)` returns `true`.
|
||||||
that can be executed via `pred(element)`.
|
|
||||||
|
The predicate is passed to $(REF unaryFun, std,functional), and can be either a string, or
|
||||||
|
any callable that can be executed via `pred(element)`.
|
||||||
|
|
||||||
Params:
|
Params:
|
||||||
predicate = Function to apply to each element of range
|
predicate = Function to apply to each element of range
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
`filter!(predicate)(range)` returns a new range containing only elements `x` in `range` for
|
An input range that contains the filtered elements. If `range` is at least a forward range, the return value of `filter`
|
||||||
which `predicate(x)` returns `true`.
|
will also be a forward range.
|
||||||
|
|
||||||
See_Also:
|
See_Also:
|
||||||
$(HTTP en.wikipedia.org/wiki/Filter_(higher-order_function), Filter (higher-order function))
|
$(HTTP en.wikipedia.org/wiki/Filter_(higher-order_function), Filter (higher-order function)),
|
||||||
|
$(REF filterBidirectional, std,algorithm,iteration)
|
||||||
*/
|
*/
|
||||||
template filter(alias predicate)
|
template filter(alias predicate)
|
||||||
if (is(typeof(unaryFun!predicate)))
|
if (is(typeof(unaryFun!predicate)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue