August 21, 2020 [Issue 21183] New: schwartzSort does not strip const | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21183 Issue ID: 21183 Summary: schwartzSort does not strip const Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: minor Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: default_357-line@yahoo.de Consider the following code: import std.algorithm : schwartzSort; import std.array : array; struct S { int i; const(int) foo() { return i; } } void main() { auto list = [S(4), S(3), S(2)]; assert(list.dup.schwartzSort!(a => a.foo).array == [S(2), S(3), S(4)]); } This leads to cryptic errors due to the fact that `schwartzSort` does not strip the `const` from `const(int)` for its internal array, even though it trivially could since it's a value type. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply