www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15960] New: SetUnion should filter duplicates


          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


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