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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c548fcf2944e2c9b X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!x35g2000hsb.googlegroups.com!not-for-mail From: george.priv@gmail.com Newsgroups: comp.lang.ada Subject: Re: What's wrong with my code? Date: Mon, 28 Apr 2008 08:23:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <5a3b83ab-c9eb-448d-8e01-093df11bd3d2@b1g2000hsg.googlegroups.com> NNTP-Posting-Host: 151.196.71.114 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1209396190 16250 127.0.0.1 (28 Apr 2008 15:23:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 28 Apr 2008 15:23:10 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x35g2000hsb.googlegroups.com; posting-host=151.196.71.114; posting-account=VnNb3AoAAACTpRtCcTrcjmPX7cs92k1Q User-Agent: G2/1.0 X-HTTP-Via: 1.1 SPARKS X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:21098 Date: 2008-04-28T08:23:10-07:00 List-Id: On Apr 28, 10:42 am, amal.alpho...@gmail.com wrote: > Sorry if I'm posting in the wrong forum. > > I have a generic package, with specification: > > generic > type Element is private; > with procedure Element_Put(E : in Element); > package SelectionP is > type My_Array is array (0..10) of Element; > Max : constant Integer := 10; > procedure Find_Min (A : My_Array; Offset : Integer; Pos : Integer); > procedure Swap (A : in out My_Array; First : Integer; Second : > Integer); > procedure Sort (A : in out My_Array); > procedure Print (A : in My_Array); > end SelectionP; > -------------------------------------------------- > and its package body is: > > package body SelectionP is > > A : My_Array; > > procedure Find_Min (A : My_Array; Offset : Integer; Pos : Integer) > is > ... > end Find_Min; > > procedure Swap (A : in out My_Array; First : Integer; Second : > Integer) is > ... > end Swap; > > procedure Sort (A : in out My_Array) is > ... > end Sort; > procedure Print (A: in out My_Array) is > ... > end Print; > > end SelectionP; > ------------------------------------------- > > And I try to make use of this package in this file: > with Ada.Text_IO, Ada.Integer_Text_IO; > with SelectionP; > procedure SelectionPUser is > package IntSelectionP is new SelectionP(Integer, Ada.Text_IO.Put); should be: package IntSelectionP is new SelectionP(Integer, Ada.Integer_Text_IO.Put); > begin > Ada.Text_IO.New_Line; > end SelectionPUser; > > --- > > I try to compile but it says 'no visible subprogram matches the > specification for Element_Put' referring to the line above where I > make the new package IntSelectionP. I can't see what i've done wrong. > > Also, is my code correct if my purpose is to use the package to create > arrays of different elements (integer, character, etc) and use the > procedures Find_Min and Sort and Print on them? For these types you should be fine. For more complex types you may need to define "<" and "=" operators. George. > > Thanks