[Issue 17264] uniq fails with const elements

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Mar 18 13:13:05 PDT 2017


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

--- Comment #1 from elpenguino+D at gmail.com ---
Elements with a disabled default constructor fail similarly.

struct NoDefault {
  int i;
  @disable this();
  this(int x) { i = x; }
}

NoDefault[] var = [NoDefault(0), NoDefault(1), NoDefault(1), NoDefault(2)];
assert(var.uniq.equal([NoDefault(0), NoDefault(1), NoDefault(2)]));

results in

std\algorithm\iteration.d(4912): Error: field _back must be initialized in
constructor

--


More information about the Digitalmars-d-bugs mailing list