Talk About Network

Google





Programming > Ada > Declaration of ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 10 Topic 5732 of 6006
Post > Topic >>

Declaration of private type Containers

by alexander.kleppe@[EMAIL PROTECTED] May 30, 2008 at 04:49 AM

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
 




 10 Posts in Topic:
Declaration of private type Containers
alexander.kleppe@[EMAIL P  2008-05-30 04:49:41 
Re: Declaration of private type Containers
"Dmitry A. Kazakov&q  2008-05-30 14:05:27 
Re: Declaration of private type Containers
Jean-Pierre Rosen <ros  2008-05-30 14:21:52 
Re: Declaration of private type Containers
"Randy Brukardt"  2008-05-31 00:28:09 
Re: Declaration of private type Containers
alexander.kleppe@[EMAIL P  2008-05-30 06:59:22 
Re: Declaration of private type Containers
Jean-Pierre Rosen <ros  2008-05-30 16:25:41 
Re: Declaration of private type Containers
"Steve" <nos  2008-05-30 19:04:07 
Re: Declaration of private type Containers
Adam Beneschan <adam@[  2008-05-30 09:00:38 
Re: Declaration of private type Containers
Matthew Heaney <mheane  2008-05-30 13:27:49 
Re: Declaration of private type Containers
alexander.kleppe@[EMAIL P  2008-06-04 08:40:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 15:06:46 PST 2009.