comp.lang.ada
 help / color / mirror / Atom feed
From: mfb@mbunix.mitre.org (Michael F Brenner)
Subject: Re: generic binary tree in ada 83
Date: 1998/04/28
Date: 1998-04-28T00:00:00+00:00	[thread overview]
Message-ID: <6i55q1$nfe@top.mitre.org> (raw)
In-Reply-To: 35461333.6DFB@westcott.force9.co.uk


   > I have it working on a single character, but cannot get
   > it to work on generic data.

Just add the following lines on top of your package that implements
the Tree data structure on type character:

    generic
        type character is private;

and it will work on generic data. To instantiate it, use the following
code:
      package tree_of_limbs is new character_tree (character => limbs);

Then it will work on TYPE LIMBS exactly as it worked on type character.

The operational thing here, is that you already have it working on 
a single character. If you did not, then you could not re-use the
code, since the code does not work. But since you have the code
working on one type, it is often trivial to re-use it on other types
in the Ada programming lanaguage.






  parent reply	other threads:[~1998-04-28  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-28  0:00 generic binary tree in ada 83 karen westcott
1998-04-28  0:00 ` Matthew Heaney
1998-04-28  0:00 ` Michael F Brenner [this message]
1998-04-28  0:00   ` Robert Dewar
1998-04-29  0:00   ` Pascal Obry
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox