comp.lang.ada
 help / color / mirror / Atom feed
From: alexander.kleppe@web.de
Subject: Declaration of private type Containers
Date: Fri, 30 May 2008 04:49:41 -0700 (PDT)
Date: 2008-05-30T04:49:41-07:00	[thread overview]
Message-ID: <6d6feee1-fe69-4d19-9745-4748d341a56e@r66g2000hsg.googlegroups.com> (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



             reply	other threads:[~2008-05-30 11:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 11:49 alexander.kleppe [this message]
2008-05-30 12:05 ` Declaration of private type Containers 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
replies disabled

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