Commit graph

937 commits

Author SHA1 Message Date
Paul Backus
54a4afae9c
Merge pull request #8912 from ntrel/mut-remove
[std.algorithm.mutation] Improve `remove` docs
2024-02-15 08:59:06 -05:00
Walter Bright
42b8c65ccf CheckBy postblit should be scope 2024-02-12 09:24:07 +01:00
Nick Treleaven
ca9561b389 [std.algorithm.mutation] Improve remove docs
Make examples runnable.
Add 2 subheadings.
Minor tweaks.
Fix throwing example of tuple offset.
2024-02-10 12:34:45 +00:00
Mathis Beer
5976fe8c1a Fix Bugzilla issue 24342: Actually check that range and sentinel types match in until before using "sentinel as subrange" mode.
`until` does special magic when `Sentinel` consists of multiple elements of `Range`. However, because `Range` can be a range of ranges, in which case even a `Sentinel` that is a range may still only be a single element, we must confirm that the element type of `Sentinel` is actually the same as `Range` before enabling this.
The `immutable ElementEncodingType` idiom is stolen from `startsWith`, which forms the basis of `until` anyways (see `predSatisfied`).
2024-01-18 14:56:52 +08:00
Dennis
8c39523ba9
Merge pull request #8857 from ntrel/find-split-result
[std.algorithm.searching] Refactor `findSplit` result types
2023-11-28 23:38:54 +01:00
Dennis
505f81ab87
Merge pull request #8856 from ntrel/find-split-docs
[std/algorithm/searching] Improve findSplit docs
2023-11-28 23:34:43 +01:00
Nick Treleaven
52ae4d36a9 3 minor tweaks 2023-11-28 17:38:29 +00:00
Nick Treleaven
0819fec814 [std.algorithm.searching] Refactor findSplit result types 2023-11-28 17:28:55 +00:00
Nick Treleaven
6b5f730b84 [std/algorithm/searching] Improve findSplit docs
Improve formatting for returned tuple.
Fix type of `result[1]` for After/Before.
Fix `pred` description.
Show example using custom `pred`.
2023-11-27 17:19:31 +00:00
Dennis
fe33c84610
Merge pull request #8836 from ntrel/fold-docs
[std.algorithm] Improve `fold` docs
2023-11-20 17:36:06 +01:00
Nick Treleaven
0ced94ca1c
[std.algorithm] Split find docs into 2 (#8844)
It's much clearer to have separate docs for the overload not taking
`needle`, because its `pred` has a different signature and its behaviour
is simpler. It was necessary to move that overload (and its unittests)
above the other two.

Also improve the docs for the other overloads:
Remove duplicate BIGOH sentence already present under *Complexity*.
Use `e, n` for predicate parameter names, short for `element, needle`.
2023-11-20 22:19:03 +08:00
Nick Treleaven
edc5bbde7b Make new tests documented 2023-11-20 11:11:44 +00:00
Nick Treleaven
a2c2f79dfa Fix Issue 11111 - std.algorithm.canFind should support Needles...
The requirement that each needle must be a range is arbitrary, so remove
it.
Note: This overload of `canFind` calls `find(haystack, needles)` which
calls `startsWith`, which accepts mixed element and range needles.
2023-11-20 10:58:16 +00:00
Nick Treleaven
585ddbe691
[std.algorithm] Improve canFind docs (#8843)
Minor tweaks.
Fix wrong `LREF`.
Also fix wrong `REF` to `among`.
2023-11-20 05:55:26 +08:00
Nick Treleaven
7f06f2358a Rename b to e for element in predicates 2023-10-31 17:40:45 +00:00
Nick Treleaven
2170bb37bc Tweak seed description 2023-10-31 17:37:05 +00:00
Nick Treleaven
5762f3311b Explain predicate signature 2023-10-31 17:26:48 +00:00
Nick Treleaven
f491d1f233 [std.algorithm] Improve fold docs
Mention iteratively calling predicates in summary.
Use list to explain calling a single predicate with a seed.
Mention multiple results are produced in description.
Use list for see also.
Rename `seed` parameter `seeds` and fix docs.
Fix result docs when >1 predicate.
2023-10-30 16:17:24 +00:00
Per Nordlöw
578dfbfeb3 Correct spelling of Seperator to Separator in joiner() 2023-10-10 15:58:42 +02:00
Iain Buclaw
faca94c214 Fix broken tests caused by merge conflicts 2023-07-15 14:15:20 +00:00
Iain Buclaw
ab307c9acf Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-07-15 13:49:21 +00:00
FeepingCreature
dfcbee7056 Fix issue 24027: Instead of a bunch of special-cases, just check that Rebindable did in fact alias itself away.
This looks ugly, but it's just for the `stable` branch - this is fixed on `master` via the `Rebindable2` rewrite https://github.com/dlang/phobos/pull/8768
2023-07-04 01:31:32 +02:00
Iain Buclaw
a3526d11dd Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-07-02 02:10:20 +00:00
Mathis Beer
10601cc046 Add std.typecons.Rebindable2 for internal use.
Rebindable2 is a simplified version of std.typecons.Rebindable that clears up every special case: classes, arrays and structs now have the same struct.
Whichever type you instantiate `Rebindable2` with, you always get the same type out by calling `value.get` on the resulting container.
Also use this type to simplify the parts of Phobos we previously used `Rebindable` for.
2023-06-19 13:24:30 +02:00
Dennis
5cd77a6e32
User hyperlinks to refer to bugzilla issues (#8766) 2023-06-16 14:45:44 +03:00
FeepingCreature
f715941036 Fix issue 23993: Discard Rebindable before passing extremum to comparator. 2023-06-15 19:06:27 +02:00
Robert burner Schadek
e1f7edae57 Better std.algorithm.iteration.permutations error messages 2023-05-26 05:45:32 +02:00
Mathis Beer
2f6b2efaf7 Change struct Rebindable to just use cast() if this is sufficient.
This works better at compiletime.
2023-04-19 22:59:43 +00:00
Mathis Beer
b818901e63 Fix issue 22786 (immutable element in maxElement) by always using Rebindable. 2023-04-19 22:59:43 +00:00
FeepingCreature
656ae7905e
Fix issue 22785: joiner should Unqual child ranges. (#8737)
* Fix issue 22785: `joiner` should `Unqual` child ranges.
This allows use with `immutable T[][]` and similar.

---------

Co-authored-by: Petar Kirov <petar.p.kirov@gmail.com>
2023-04-20 01:59:19 +03:00
Nick Treleaven
01a12f919e
[std.algorithm.searching] Don't instantiate template pred in all and any constraints (#8715)
Fixes Issue 23769 - Lambda isn't a unary predicate for lambda that
doesn't compile.
2023-04-10 19:10:18 +03:00
Nick Treleaven
72da991685
[std.algorithm.searching] Fix 2 typos in docs (#8728) 2023-03-31 15:38:47 +03:00
Robert burner Schadek
d8c627e037 Better std.algorithm.comparison.clamp error messages 2023-03-15 16:53:20 +01:00
Robert burner Schadek
8546da5b04 Better std.algorithm.iteration.filter error messages 2023-02-21 10:17:22 +01:00
Ikey Doherty
ac8318c5ad
algorithm/sorting: Fix typo introduced in PR #8678
Typo specifically introduced in:

 - baaa1117de

Signed-off-by: Ikey Doherty <ikey@serpentos.com>
2023-02-18 14:33:49 +00:00
Robert burner Schadek
ef2eb4fdb7 Better Sort static assert error messages 2023-02-13 21:14:34 +01:00
Iain Buclaw
6d7b83d49c Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-02-13 01:30:01 +00:00
Mathis Beer
c06e3171f1 Fix issue 23668: TimSort must avoid default initialization if the type being sorted has it disabled. 2023-02-04 09:51:27 +01:00
DanutAldea
cce4c938dd Fix Issue 20397 2023-02-01 00:44:25 +01:00
H. S. Teoh
08be61029e Clarify that .uniq by default expects a sorted range. 2022-12-09 03:18:46 +01:00
Paul Backus
792c8b7c1d Fix typo in doc for std.algorithm.mutation.fill 2022-12-06 19:52:21 +01:00
Lucian Danescu
322fed7bf7 add local imports 2022-11-12 19:29:28 +02:00
Nick Treleaven
281f42d306
Fix missing unittests in docs (#8603)
* Fix missing staticArray unittest in docs

Found using https://github.com/dlang/dmd/pull/14527.

* Fix missing FloatRep and DoubleRep unittests in docs

* 2 JSONValue op overloads

* std.random

* detabber

* remove

* std.digest.murmurhash
2022-10-17 05:43:13 +08:00
The Dlang Bot
b026e490c4
Merge pull request #8580 from jamesragray/b18975
Make permutations into forward range.

Signed-off-by: Razvan Nitu <RazvanN7@users.noreply.github.com>
Signed-off-by: H. S. Teoh <quickfur@users.noreply.github.com>
Merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2022-09-27 01:05:31 +02:00
james
872bb2cdb4 Fixed a typo in comment. 2022-09-26 22:49:44 +02:00
Razvan Nitu
88aa69b14f
Merge pull request #8570 from jamesragray/untilsimplerfix
Fix issue 14543: std.algorithm.searching.until does n…
2022-09-26 05:56:49 +03:00
james
8744064c6f Fix issue 23362: Permutations should be a forward range. 2022-09-23 22:39:15 +02:00
Dennis Korpel
2866acf18d Fix @system annotation in multisort unittest 2022-09-23 17:11:42 +02:00
james
bc5126469e Fix Issue 14542 - std.algorithm.searching.until does not handle range sentinels nicely 2022-09-23 16:44:42 +02:00
james
cd42a6a81f Style fixes. 2022-09-21 23:10:20 +02:00