comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Declaration of private type Containers
Date: Fri, 30 May 2008 09:00:38 -0700 (PDT)
Date: 2008-05-30T09:00:38-07:00	[thread overview]
Message-ID: <40f1bdc6-ad4a-48ee-b3fc-6d44ac24955b@w5g2000prd.googlegroups.com> (raw)
In-Reply-To: 8910e931-889f-4617-a249-71b5016a13e2@r66g2000hsg.googlegroups.com

On May 30, 6:59 am, alexander.kle...@web.de wrote:
> Thanks so far.
> So if I understand you right, there is no way to declare the list
> package within the spec file of My_Type beside declaring My_Type
> public?

You could use a nested package, although I'm not sure if this would
give you what you want:

   package A is

       package Nested is
          type My_Type is private;
       private
          type My_Type is ...
       end Nested;

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

   end A;

This is legal, and My_Type_Lists is now inside A as you want, but now
only the body of A.Nested will have access to the full definition of
Nested.  Maybe it could be made to work, though.

                             -- Adam





  parent reply	other threads:[~2008-05-30 16:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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