From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8e7ac81a215f128c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!83.128.0.12.MISMATCH!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!news.astraweb.com!border2.a.newsrouter.astraweb.com!feeder1-1.proxad.net!proxad.net!feeder1-2.proxad.net!193.252.117.184.MISMATCH!feeder.news.orange.fr!not-for-mail Message-ID: <4CE0F407.6090101@gmail.com> Date: Mon, 15 Nov 2010 09:49:11 +0100 From: Stephane Carrez User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101027 Lightning/1.0b1 Thunderbird/3.0.10 MIME-Version: 1.0 Newsgroups: comp.lang.ada To: Alex Mentis Subject: Re: Using Red-Black Trees References: <2419e829-6f45-4075-9005-b9876beb8aaa@r6g2000vbf.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Organization: les newsgroups par Orange NNTP-Posting-Date: 15 Nov 2010 09:49:11 CET NNTP-Posting-Host: 90.46.166.61 X-Trace: 1289810951 reader.news.orange.fr 5433 90.46.166.61:5710 X-Complaints-To: abuse@orange.fr Xref: g2news1.google.com comp.lang.ada:15498 Date: 2010-11-15T09:49:11+01:00 List-Id: Hi! On 11/13/2010 02:10 PM, Alex Mentis wrote: > Bj�rn wrote: > >> I need a self-balancing binary search tree (for a Bentley/Ottmann >> implementation), such as the red-black tree that is now part of >> Ada.Containers. I need basic operations like insert/remove, next/prev >> and find. However, the GNAT implementation of this data structure >> seems a bit scary to me and I'm not really sure how to instantiate the >> generics and what operations to use. Would someone be able to provide >> some example of usage? And yes, I'am aware of that a lot of the other >> container implementations uses this structure. I was hoping for >> something a bit more boiled down. >> >> Regards, >> Bj�rn > > There's a Red-Black Tree in Ada.Containers?! Can someone tell me where > to find it in the ARM? GNAT uses the Red-Black tree for the implementation of ordered maps and sets. You should use Ada.Containers.Ordered_Maps instead. Instantiation is similar to the Hashed_Maps but you should need to specify the comparison operator "<". See http://www.adaic.org/standards/05rm/html/RM-A-18-6.html (Likewise for the Indefinite_Ordered_* packages) Stephane