comp.lang.ada
 help / color / mirror / Atom feed
* Mixin with preelaborated element
@ 2000-05-31  0:00 Lutz Donnerhacke
  2000-05-31  0:00 ` Antonio Dur�n Dom�nguez
  0 siblings, 1 reply; 3+ messages in thread
From: Lutz Donnerhacke @ 2000-05-31  0:00 UTC (permalink / raw)


I run into a problem with my list_mixin.
  ftp://ftp.iks-jena.de/pub/mitarb/lutz/ada/types/list_mixin.ad?

generic
   type Base (<>) is abstract tagged limited private;
   type S    (<>) is abstract new Base with private;
package List_Mixin is
   type T is abstract new S with private;
   type T_Class is access all T'Class;
   type List is limited private;
   -- several lines of code deleted
private
   type T is abstract new S with
      record
         Next : T_Class := null;
         Used : Boolean := False;  -- to detect multiple insertions
      end record;
   
   type List is limited
      record
         Start : T_Class := null;
      end record;
   -- several lines of code deleted
end List_Mixin;

The current implementation use null at the tail marker. This requires the
flag Used and causes a lot of ineffient code.

So I'd like to introduce a single fixed end node used by all instantiations.
It should contain only the Next element.

How can I achieve it?

Using assembly I added the link in front of the structure and ignored the
varying context following it. Good examples can be found in D.E.Knuth TAoCP.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-06-01  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-31  0:00 Mixin with preelaborated element Lutz Donnerhacke
2000-05-31  0:00 ` Antonio Dur�n Dom�nguez
2000-06-01  0:00   ` Lutz Donnerhacke

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