Re: Inserting and removing elements from a sorted container

2017-11-19 Thread Dirk via Digitalmars-d-learn
Thank you very much for your thorough answer! /Dirk

Re: Inserting and removing elements from a sorted container

2017-11-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, November 19, 2017 16:48:00 Dirk via Digitalmars-d-learn wrote: > On Sunday, 19 November 2017 at 16:05:53 UTC, Jonathan M Davis > > wrote: > > I'd suggest that you use std.container.rbtree..RedBlackTree. A > > red-black tree exactly the sort of data structure that is > > typically used in

Re: Inserting and removing elements from a sorted container

2017-11-19 Thread Dirk via Digitalmars-d-learn
On Sunday, 19 November 2017 at 16:05:53 UTC, Jonathan M Davis wrote: I'd suggest that you use std.container.rbtree..RedBlackTree. A red-black tree exactly the sort of data structure that is typically used in a sorted set. - Jonathan M Davis Thank you, i will look into it. I have a questi

Re: Inserting and removing elements from a sorted container

2017-11-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, November 19, 2017 13:41:51 Dirk via Digitalmars-d-learn wrote: > Hi! > > I want to add an uint into a container, but avoid duplicate > uints, similar to a set<> from C++ STL. > > To find out if an uint is already present in the container, it > would make sense if the container is sorted.

Inserting and removing elements from a sorted container

2017-11-19 Thread Dirk via Digitalmars-d-learn
Hi! I want to add an uint into a container, but avoid duplicate uints, similar to a set<> from C++ STL. To find out if an uint is already present in the container, it would make sense if the container is sorted. This is some pseudo-D-code that should make clear what i want to do: auto so