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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,927ae253da8bb547 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-30 12:46:45 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!opentransit.net!wanadoo.fr!not-for-mail From: "Baugereau" Newsgroups: comp.lang.ada Subject: Re: Specialization Date: Thu, 30 May 2002 21:48:48 +0200 Organization: Wanadoo, l'internet avec France Telecom Message-ID: References: <4519e058.0205300909.5bfb317d@posting.google.com> Reply-To: "Baugereau" NNTP-Posting-Host: afontenayssb-103-1-4-21.abo.wanadoo.fr X-Trace: wanadoo.fr 1022788004 15320 80.11.133.21 (30 May 2002 19:46:44 GMT) X-Complaints-To: abuse@wanadoo.fr NNTP-Posting-Date: 30 May 2002 19:46:44 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Xref: archiver1.google.com comp.lang.ada:25031 Date: 2002-05-30T19:46:44+00:00 List-Id: > This is the problem. You should (almost certainly :) have an array of > ELEMENTPTR, not an array of ELEMENT. When an element is added to > Vector, you call 'new' for it. When an element is erased from the > vector you call an instantiation of Unchecked_Deallocation on it. Then > Finalize will be called automatically, if necessary. > > See the file sal-poly-unbounded_arrays.ads > in SAL at http://users.erols.com/leakstan/Stephe/Ada/sal.html > for an example of a similar package. > > You will find that you will have to allow your generic ELEMENT type to > be unconstrained and/or indefinite, if the Vector package is to be > truly useful. For example, try to define a Vector of String. Once you > do that, you are forced to have an array of pointer-to-element. > Ok so this is the difference of philosophy with STL's vector, which is plain value-oriented. What I dislike here is the lack of locality of the elements, and the need to "new" every time I add an element... Any comment?