digitalmars.D.learn - Ordered set container?
- Victor Porton (3/3) Jan 28 2019 I want "ordered set" container (like list or vector but with the
- Neia Neutuladh (3/7) Jan 28 2019 std.container.rbtree
- H. S. Teoh (5/9) Jan 28 2019 Try std.container.rbtree.RedBlackTree.
- Dukc (11/13) Jan 29 2019 The above answers are ordered, but if you want a type that's a
I want "ordered set" container (like list or vector but with the warranty of no duplicate elements). Which type can I use?
Jan 28 2019
On Mon, 28 Jan 2019 17:18:52 +0000, Victor Porton wrote:I want "ordered set" container (like list or vector but with the warranty of no duplicate elements). Which type can I use?std.container.rbtree It has options to preserve or squash duplicates.
Jan 28 2019
On Mon, Jan 28, 2019 at 05:18:52PM +0000, Victor Porton via Digitalmars-d-learn wrote:I want "ordered set" container (like list or vector but with the warranty of no duplicate elements). Which type can I use?Try std.container.rbtree.RedBlackTree. T -- That's not a bug; that's a feature!
Jan 28 2019
On Monday, 28 January 2019 at 17:18:52 UTC, Victor Porton wrote:I want "ordered set" container (like list or vector but with the warranty of no duplicate elements).The above answers are ordered, but if you want a type that's a simple sorted array, there's none at the standard library besides SortedRange, which you can't add to. (Mostly for a good reason, because adding elements to such an array after the initial sorting would be very slow). https://github.com/nordlow/justd/blob/master/stdx/container/sorted.d contains an implementation of such an array, but one cannot currently use it legally, because it is not licensed. I don't know if the author did that intentionally (Nordlöw, are you around?)
Jan 29 2019