* How to use Multiway_Trees
@ 2017-04-09 15:36 Mart van de Wege
2017-04-09 16:27 ` Niklas Holsti
0 siblings, 1 reply; 6+ messages in thread
From: Mart van de Wege @ 2017-04-09 15:36 UTC (permalink / 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to use Multiway_Trees
2017-04-09 15:36 How to use Multiway_Trees Mart van de Wege
@ 2017-04-09 16:27 ` Niklas Holsti
2017-04-09 16:34 ` Simon Wright
0 siblings, 1 reply; 6+ messages in thread
From: Niklas Holsti @ 2017-04-09 16:27 UTC (permalink / raw)
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
. @ .
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to use Multiway_Trees
2017-04-09 16:27 ` Niklas Holsti
@ 2017-04-09 16:34 ` Simon Wright
2017-04-09 16:49 ` Mart van de Wege
0 siblings, 1 reply; 6+ messages in thread
From: Simon Wright @ 2017-04-09 16:34 UTC (permalink / raw)
Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
> 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...).
Also on macOS 10.12.4 with GNAT GPL 2016 and FSF GCC version 7.0.1 20170408
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to use Multiway_Trees
2017-04-09 16:34 ` Simon Wright
@ 2017-04-09 16:49 ` Mart van de Wege
2017-04-11 19:56 ` Dirk Heinrichs
0 siblings, 1 reply; 6+ messages in thread
From: Mart van de Wege @ 2017-04-09 16:49 UTC (permalink / raw)
Simon Wright <simon@pushface.org> writes:
> Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
>
>> 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...).
>
> Also on macOS 10.12.4 with GNAT GPL 2016 and FSF GCC version 7.0.1 20170408
Weird. This is a Debian Jessie system with gnat 6.1. Compilation is done
running straight gnatmake tree_test.adb.
Obviously I am doing something wrong; but what?
Mart
--
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to use Multiway_Trees
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
0 siblings, 1 reply; 6+ messages in thread
From: Dirk Heinrichs @ 2017-04-11 19:56 UTC (permalink / raw)
Am 09.04.2017 um 18:49 schrieb Mart van de Wege:
> This is a Debian Jessie system with gnat 6.1. Compilation is done
> running straight gnatmake tree_test.adb.
Works here, too. Debian Stretch with GCC version 6.3.0 20170321 (Debian
6.3.0-11).
Bye...
Dirk
--
Dirk Heinrichs <dirk.heinrichs@altum.de>
GPG Public Key: D01B367761B0F7CE6E6D81AAD5A2E54246986015
Sichere Internetkommunikation: http://www.retroshare.org
Privacy Handbuch: https://www.privacy-handbuch.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to use Multiway_Trees
2017-04-11 19:56 ` Dirk Heinrichs
@ 2017-04-12 8:15 ` Mart van de Wege
0 siblings, 0 replies; 6+ messages in thread
From: Mart van de Wege @ 2017-04-12 8:15 UTC (permalink / raw)
Dirk Heinrichs <dirk.heinrichs@altum.de> writes:
> Am 09.04.2017 um 18:49 schrieb Mart van de Wege:
>
>> This is a Debian Jessie system with gnat 6.1. Compilation is done
>> running straight gnatmake tree_test.adb.
>
> Works here, too. Debian Stretch with GCC version 6.3.0 20170321 (Debian
> 6.3.0-11).
>
Re-checked. I was wrong, this is not Jessie, but Sid, and the compiler
is gcc 6.3.0-4 (why does my Sid have an older version than your
Stretch?)
I think this is something to take to the Debian-Ada mailing list.
Mart
--
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-04-12 8:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-09 15:36 How to use Multiway_Trees Mart van de Wege
2017-04-09 16:27 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox