mirror of
https://github.com/dlang/phobos.git
synced 2025-05-04 17:11:26 +03:00
Add short descriptions for each overload set; minor tweaks
Short descriptions improve ddox output. Use overload instead of version.
This commit is contained in:
parent
e695747422
commit
4ea7dd3e07
1 changed files with 10 additions and 6 deletions
|
@ -606,15 +606,17 @@ if (isNarrowString!R1 && isNarrowString!R2)
|
||||||
|
|
||||||
// count
|
// count
|
||||||
/**
|
/**
|
||||||
The first version counts each element `e` in `haystack` for
|
Counts matches of `needle` in `haystack`.
|
||||||
|
|
||||||
|
The first overload counts each element `e` in `haystack` for
|
||||||
which `pred(e, needle)` is `true`. `pred` defaults to
|
which `pred(e, needle)` is `true`. `pred` defaults to
|
||||||
equality. Performs $(BIGOH haystack.length) evaluations of `pred`.
|
equality. Performs $(BIGOH haystack.length) evaluations of `pred`.
|
||||||
|
|
||||||
The second version counts the number of times `needle` was matched in
|
The second overload counts the number of times `needle` was matched in
|
||||||
`haystack`. `pred` compares elements in each range.
|
`haystack`. `pred` compares elements in each range.
|
||||||
Throws an exception if `needle.empty`, as the _count
|
Throws an exception if `needle.empty` is `true`, as the _count
|
||||||
of the empty range in any range would be infinite. Overlapped counts
|
of the empty range in any range would be infinite. Overlapped counts
|
||||||
are not considered, for example `count("aaa", "aa")` is `1`, not
|
are *not* considered, for example `count("aaa", "aa")` is `1`, not
|
||||||
`2`.
|
`2`.
|
||||||
|
|
||||||
Note: Regardless of the overload, `count` will not accept
|
Note: Regardless of the overload, `count` will not accept
|
||||||
|
@ -707,10 +709,12 @@ if (isForwardRange!R1 && !isInfinite!R1 &&
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The first version counts each element `e` in `haystack` for which `pred(e)` is $(D
|
Counts all elements or elements satisfying a predicate in `haystack`.
|
||||||
|
|
||||||
|
The first overload counts each element `e` in `haystack` for which `pred(e)` is $(D
|
||||||
true). Performs $(BIGOH haystack.length) evaluations of `pred`.
|
true). Performs $(BIGOH haystack.length) evaluations of `pred`.
|
||||||
|
|
||||||
The second version counts the number of elements in a range.
|
The second overload counts the number of elements in a range.
|
||||||
If the given range has the `length` property,
|
If the given range has the `length` property,
|
||||||
that is returned right away, otherwise
|
that is returned right away, otherwise
|
||||||
performs $(BIGOH haystack.length) to walk the range.
|
performs $(BIGOH haystack.length) to walk the range.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue