comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: How to access Vector.Index_Type?
Date: Mon, 18 Mar 2019 20:35:32 +0100
Date: 2019-03-18T20:35:32+01:00	[thread overview]
Message-ID: <q6oru4$hl3$1@dont-email.me> (raw)
In-Reply-To: <a0a952ea-0eb7-4129-8c19-87c9f4c7db2d@googlegroups.com>

On 3/17/19 9:43 PM, jakub.dabek@gmail.com wrote:
> I have the following program
> 
>      with Ada.Containers.Vectors;
> 
>      procedure Test is
>          package MyVec is new Ada.Containers.Vectors(Natural, Natural);
>          Var : MyVec.Index_Type;
>      begin
>          null;
>      end;
> 
> I get the following error:
> "Index_Type" is not a visible entity of "MyVec"
> 
> How can I access the index type (`Element_Type` gives the same error message), without just writing `Natural`?

This is refreshing. Usually people complain that Ada makes them type too much. 
It's unusual to see someone complain that Ada makes them type less than they want.

If you are dealing with pkg Myvec, Ada presumes that you will look at the 
instantiation and see that it says

Index_Type => Natural

and use Natural when you want an index.

-- 
Jeff Carter
"What I wouldn't give for a large sock with horse manure in it."
Annie Hall
42

      parent reply	other threads:[~2019-03-18 19:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-17 20:43 How to access Vector.Index_Type? jakub.dabek
2019-03-17 21:25 ` Simon Wright
2019-03-18  0:12   ` jakub.dabek
2019-03-18  8:21     ` Simon Wright
2019-03-18  4:17 ` gautier_niouzes
2019-03-18  5:27 ` J-P. Rosen
2019-03-18  8:31   ` Dmitry A. Kazakov
2019-03-18 20:59     ` briot.emmanuel
2019-03-18 23:01       ` J-P. Rosen
2019-03-18 19:35 ` Jeffrey R. Carter [this message]
replies disabled

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