From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: How to use Multiway_Trees
Date: Sun, 9 Apr 2017 19:27:15 +0300
Date: 2017-04-09T19:27:15+03:00 [thread overview]
Message-ID: <ekv5n3F3pfdU1@mid.individual.net> (raw)
In-Reply-To: <868tn9y4mp.fsf@gaheris.avalon.lan>
On 17-04-09 18:36 , Mart van de Wege wrote:
> I was interested in using Ada.Containers.Multiway_Trees in another
> project, so I wrote some Proof of Concept code to see if I understood
> correctly how to use it.
>
> However, even the most simple use case, the following code, raises a
> Program_Error:
>
> raised PROGRAM_ERROR : Tree_Test.Test_Tree.Replace_Element: Position cursor designates root
>
> with Ada.Text_Io;
> with Ada.Containers.Multiway_Trees;
> procedure Test_Tree is
> type String_Access is access String;
> package Tr is new Ada.Containers.Multiway_Trees
> ( Element_Type => String_Access );
> use Tr;
> T : Tree := Empty_Tree;
> C : Cursor := Root(T);
> begin
> T.Insert_Child(Parent => C,
> Before => No_Element,
> New_Item => new String'("Test"));
> end Test_Tree;
>
> How do I create a tree if I can't even insert a child under the root
> node?
>
> Mart
That code works (no exceptions, and T.Node_Count = 2 after the
Insert_Child) on my system, which is a Mac OS X 10.8.5 with GNAT GPL
2012 (old, yes...).
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
next prev parent reply other threads:[~2017-04-09 16:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-09 15:36 How to use Multiway_Trees Mart van de Wege
2017-04-09 16:27 ` Niklas Holsti [this message]
2017-04-09 16:34 ` Simon Wright
2017-04-09 16:49 ` Mart van de Wege
2017-04-11 19:56 ` Dirk Heinrichs
2017-04-12 8:15 ` Mart van de Wege
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox