std.algorithm.sort with copy constructors

Steven Schveighoffer schveiguy at gmail.com
Mon Apr 13 14:24:40 UTC 2020


On 4/13/20 9:27 AM, Gregor Mückl wrote:
> import std;
> 
> struct S {
>      pure this(ref return scope const S rhs) nothrow @nogc {
>          this.x = x;
>      }
> 
>      int x;
> }
> 
> void main()
> {
>      S[] array = new S[10];
>      array.sort!("a.x < b.x", SwapStrategy.stable);
> }

This is a bug in phobos.

https://issues.dlang.org/show_bug.cgi?id=20732

Also went down a rabbit hole due to this:

https://issues.dlang.org/show_bug.cgi?id=20733

-Steve


More information about the Digitalmars-d-learn mailing list