Bug 15960 – SetUnion should filter duplicates

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-04-27T03:47:00Z
Last change time
2016-10-01T11:47:01Z
Assigned to
nobody
Creator
greensunny12

Comments

Comment #0 by greensunny12 — 2016-04-27T03:47:57Z
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] ```
Comment #1 by github-bugzilla — 2016-08-29T00:15:44Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/501a1d5f41ec980b2b8c67b7a1fc31b6e65991a9 fix issue 15960 - deprecate setUnion in favor of merge https://github.com/dlang/phobos/commit/5c5dda3dfba0cc859864072b6247f4097b57dd3a Merge pull request #4249 from wilzbach/fix_15960 fix issue 15960 - deprecate setUnion in favor of merge
Comment #2 by github-bugzilla — 2016-10-01T11:47:01Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/501a1d5f41ec980b2b8c67b7a1fc31b6e65991a9 fix issue 15960 - deprecate setUnion in favor of merge https://github.com/dlang/phobos/commit/5c5dda3dfba0cc859864072b6247f4097b57dd3a Merge pull request #4249 from wilzbach/fix_15960