From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,25c6c17a48209275 X-Google-Attributes: gid103376,public From: "W. Wesley Groleau x4923" Subject: Re: Generics question Date: 1997/07/22 Message-ID: <33D5320C.63E3@pseserv3.fw.hac.com>#1/1 X-Deja-AN: 258209394 Sender: usenet@most.fw.hac.com (News Administration) X-Nntp-Posting-Host: sparc02 References: <5r37k9$h4p$1@kelp.mbay.net> Organization: Hughes Defense Communications Newsgroups: comp.lang.ada Date: 1997-07-22T00:00:00+00:00 List-Id: > I have a computational algorithm that I've implemented that has > the (admitedly unusual) property that it is perfectly valid for either > arrays of Integers or arrays of Floats. As far as I can see I > CANNOT make a generic version of the package that will work for > both, e.g.: > > Generic > Type Element is > Type DataArray is Array(Natural Range<>) of Element; > > ..... > > Is there a way to do this ? or do I have to actually make two different copies > (which differ only in the definition of ELEMENT). Does it use attributes of type Element? If not, say generic type Element is private; type Data_Array is Array(Natural Range<>) of Element; .... when you try to compile, you'll get error messages about undefined operators. Something along the lines of "*"(Element,element)return element is not defined. When that happens, add function "*" ( L, R : Element ) return Element is <>; to your list of formal parameters. -- ---------------------------------------------------------------------- Wes Groleau, Hughes Defense Communications, Fort Wayne, IN USA Senior Software Engineer - AFATDS Tool-smith Wanna-be wwgrol AT pseserv3.fw.hac.com Don't send advertisements to this domain unless asked! All disk space on fw.hac.com hosts belongs to either Hughes Defense Communications or the United States government. Using email to store YOUR advertising on them is trespassing! ----------------------------------------------------------------------