Bug 13965 – More handy schwartzSort

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-10T11:56:15Z
Last change time
2019-05-17T23:05:56Z
Keywords
bootcamp, pull
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2015-01-10T11:56:15Z
This is correct code: void main() { import std.algorithm: schwartzSort, SwapStrategy, equal; import std.math: abs; auto a = [1, -10, 2]; auto s = a.schwartzSort!(abs, q{a < b}, SwapStrategy.stable); assert(s.equal([1, 2, -10])); } For practical reasons I suggest to support this kind of code too: auto s = a.schwartzSort!(abs, SwapStrategy.stable); (This means the "less" predicate can be omitted and replaced by the SwapStrategy).
Comment #1 by dlang-bot — 2019-05-10T16:29:55Z
@AurelC2G created dlang/phobos pull request #6999 "Fixed Issue 13965 - More handy schwartzSort" fixing this issue: - Fixed Issue 13965 - More handy schwartzSort https://github.com/dlang/phobos/pull/6999
Comment #2 by dlang-bot — 2019-05-17T23:05:56Z
dlang/phobos pull request #6999 "Fixed Issue 13965 - More handy schwartzSort" was merged into master: - 32346c8ded852bcfc0488b78b962b7b509367627 by Aurelien Fredouelle: Fixed Issue 13965 - More handy schwartzSort https://github.com/dlang/phobos/pull/6999