comp.lang.ada
 help / color / mirror / Atom feed
* Declaration of private type Containers
@ 2008-05-30 11:49 alexander.kleppe
  2008-05-30 12:05 ` Dmitry A. Kazakov
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: alexander.kleppe @ 2008-05-30 11:49 UTC (permalink / raw)


Hi all,

I'm relatively new to Ada. I have a problem, which seems pretty basic
to me. Thus, I guess you guys have a easy solution ready.
The only thing I want to do is to  declare a list package, whose
Element_Type is of a private record type:

package A is

type My_Type is private

package My_Type_Lists is new Ada.Containers.Doubly_Linked_List
     (Element_Type	=> My_Type);

private

type My_Type is
record
...
end record;

end A;


GNAT compiler says, this is a "premature use of private type", which I
accept. However, I don't wanna declare the My_Type_Lists package
elsewhere, which would be a possible solution.
Ideally I wanna use it in some other Package or subprogram like this:

package B is

type Rec_Type is private

package My_Type_Lists is new Ada.Containers.Doubly_Linked_List
     (Element_Type	=> A.My_Type);
-- would be possible, but not very nice

private

type Rec_Type is
record
A_List : A.My_Type_Lists.List;
end record;


So what is the correct way to declare the Container package in package
A?

Thanks in advance,
Alex



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

end of thread, other threads:[~2008-06-04 15:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-30 11:49 Declaration of private type Containers alexander.kleppe
2008-05-30 12:05 ` Dmitry A. Kazakov
2008-05-30 12:21 ` Jean-Pierre Rosen
2008-05-30 13:59   ` alexander.kleppe
2008-05-30 14:25     ` Jean-Pierre Rosen
2008-05-30 16:00     ` Adam Beneschan
2008-05-31  2:04     ` Steve
2008-05-31  5:28   ` Randy Brukardt
2008-05-30 20:27 ` Matthew Heaney
2008-06-04 15:40   ` alexander.kleppe

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