mirror of
https://github.com/dlang/phobos.git
synced 2025-04-30 23:20:29 +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
|
||||
/**
|
||||
Implements the higher order filter function. The predicate is passed to
|
||||
$(REF unaryFun, std,functional), and can either accept a string, or any callable
|
||||
that can be executed via `pred(element)`.
|
||||
`filter!(predicate)(range)` returns a new range containing only elements `x` in `range` for
|
||||
which `predicate(x)` returns `true`.
|
||||
|
||||
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:
|
||||
predicate = Function to apply to each element of range
|
||||
|
||||
Returns:
|
||||
`filter!(predicate)(range)` returns a new range containing only elements `x` in `range` for
|
||||
which `predicate(x)` returns `true`.
|
||||
An input range that contains the filtered elements. If `range` is at least a forward range, the return value of `filter`
|
||||
will also be a forward range.
|
||||
|
||||
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)
|
||||
if (is(typeof(unaryFun!predicate)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue