Missing array element
Biotronic via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 30 00:11:19 PDT 2017
On Wednesday, 30 August 2017 at 06:16:16 UTC, Vino.B wrote:
> On Tuesday, 29 August 2017 at 18:39:03 UTC, Ali Çehreli wrote:
>> https://dlang.org/phobos/std_algorithm_setops.html#.setDifference
> I tried the setDifference but does seem to be working as
> expected
From the documentation of setDifference: "The two ranges are
assumed to be sorted by less."
In other words, you will need to sort your ranges first. Either
pre-sort them as
string[] a = ["test1", "test2", "test3", "test4"];
string[] b = ["test2", "test4"]';
or call setDifference(a.sort(), b.sort()).
--
Biotronic
More information about the Digitalmars-d-learn
mailing list