From: Dale Stanbrough <dstanbro@bigpond.net.au>
Subject: Re: Array Of Constant Strings?
Date: Fri, 14 Feb 2003 07:28:33 GMT
Date: 2003-02-14T07:28:33+00:00 [thread overview]
Message-ID: <dstanbro-D81687.18282614022003@mec2.bigpond.net.au> (raw)
In-Reply-To: RXY2a.4080$io.157916@iad-read.news.verio.net
In article <RXY2a.4080$io.157916@iad-read.news.verio.net>,
Dr Nancy's Sweetie <kilroy@elvis.rowan.edu> wrote:
> Maybe I'm just doing this wrong, but the only solution I can see
> looks unreasaonbly verbose.
>
> What I want is to set up an array of constant strings, all the same
> length. I tried using Ada.Strings.Bounded, with something like
> this:
>
> package Name_Package is new Generic_Bounded_Length(7);
>
> type Name_String is new Digit_Package.Bounded_String;
>
> Name_List : constant array(1..26) of Name_String :=
> ("Anthony", "Barbara", "Claudia", "Deborah" "Elliott",
> .... and so on.
>
a more versatile solution would be to use aliased strings, and string
pointers.
type String_Ptr is access all String;
-- defined in the Ada hierachy somewhere...
type Strings is array (Positive range <>) of String_Ptr;
a : aliased String := "Anthony";
b : aliased String := "Bert";
c : aliased String := "Carla";
List : Strings := (a'Access, b'access, c'access);
(or should that be 'Unrestricted_Access?)
not as compact as C, but you end up with the same effect.
Dale
next prev parent reply other threads:[~2003-02-14 7:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-14 2:58 Array Of Constant Strings? Dr Nancy's Sweetie
2003-02-14 4:28 ` tmoran
2003-02-14 7:28 ` Dale Stanbrough [this message]
2003-02-14 7:47 ` tmoran
2003-02-14 10:06 ` Dale Stanbrough
[not found] ` <19guh-2f4.ln1@beastie.ix.netcom.com>
2003-02-14 19:41 ` Jeffrey Carter
2003-02-14 20:38 ` tmoran
[not found] ` <e0q0i-n14.ln1@beastie.ix.netcom.com>
2003-02-15 22:28 ` Jeffrey Carter
2003-02-22 19:31 ` Robert A Duff
2003-04-14 18:43 ` Dr Nancy's Sweetie
2003-04-15 11:36 ` Georg Bauhaus
2003-04-15 13:40 ` Dr Nancy's Sweetie
2003-04-15 15:13 ` Georg Bauhaus
2003-04-16 2:17 ` Matthew Heaney
2003-04-16 16:35 ` Chad R. Meiners
2003-04-16 21:03 ` Georg Bauhaus
2003-04-17 17:53 ` Robert A Duff
2003-04-17 20:34 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox