digitalmars.D.bugs - [Issue 15960] New: SetUnion should filter duplicates
- via Digitalmars-d-bugs (27/27) Apr 26 2016 https://issues.dlang.org/show_bug.cgi?id=15960
https://issues.dlang.org/show_bug.cgi?id=15960 Issue ID: 15960 Summary: SetUnion should filter duplicates Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: greensunny12 gmail.com Have a look at http://en.cppreference.com/w/cpp/algorithm/merge http://en.cppreference.com/w/cpp/algorithm/set_union tl;dr: SetUnion should filter for duplicates "The difference between these two algorithms is with handling values from both input ranges which compare equivalent (see notes on LessThanComparable). If any equivalent values appeared n times in the first range and m times in the second, std::merge would output all n+m occurrences whereas std::set_union would output std::max(n, m) ones only" ``` [1,2].merge([1,3]) == [1,1,2,3] [1,2].setUnion([1,3]) == [1,2,3] ``` --
Apr 26 2016