From: Mart van de Wege <mvdwege@gmail.com>
Subject: How to use Multiway_Trees
Date: Sun, 09 Apr 2017 17:36:46 +0200
Date: 2017-04-09T17:36:46+02:00 [thread overview]
Message-ID: <868tn9y4mp.fsf@gaheris.avalon.lan> (raw)
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
--
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.
next reply other threads:[~2017-04-09 15:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-09 15:36 Mart van de Wege [this message]
2017-04-09 16:27 ` How to use Multiway_Trees Niklas Holsti
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