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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1fa85f3df5841ae1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail Date: Wed, 27 Apr 2005 13:10:21 +0200 From: Georg Bauhaus Organization: future apps GmbH User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050324 Debian/1.7.6-1 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada.Containers.Vectors - querying multiple elements References: <426e4c2b$0$7515$9b4e6d93@newsread2.arcor-online.net> <1114530273.185327.319710@z14g2000cwz.googlegroups.com> <1114531544.32583.142.camel@localhost.localdomain> <426E72C3.9070108@on2.com> <426e90ef$0$10506$9b4e6d93@newsread4.arcor-online.net> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <426f7310$0$10498$9b4e6d93@newsread4.arcor-online.net> NNTP-Posting-Date: 27 Apr 2005 13:10:08 MEST NNTP-Posting-Host: 82d50828.newsread4.arcor-online.net X-Trace: DXC=mgQ`dYCKI_6g0XoR1BOW]<:ejgIfPPld4jW\KbG]kaM8liQbn6H@_E9LmKa@gOA124UUng9_FXZ=3>:=P9Ihe`B8@Z?dZ]MOid5 X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:10751 Date: 2005-04-27T13:10:08+02:00 List-Id: Dr. Adrian Wrigley wrote: > On Tue, 26 Apr 2005 21:05:28 +0200, Georg Bauhaus wrote: > > >>Duncan Sands wrote: >> >> >>>But (IMHO) grabbing a "slice" of a >>>vector is a very normal thing to want to do. Why not support it as >>>efficiently as possible? >> >>I'm curious. Where is slicing a dynamically sized vector >>done frequently? > > > recursive algorithms! > (and plenty of other places too.) Recursive algorithms on arrays that change their 'Length during recursion by removing or inserting slices? Or are array parameters used for the side effect of passing bounds which are really central to the algorithm? (This can be expressed using nested subprograms of two index values, like in quicksort, such that the array is visible to the subprogram.) Hmm. Is there really a big difference? When I pass an array slice to a subprogram that takes an in mode array parameter, then inside the subprogram I can look at the array properties and at elements within the array parameter's range. OTOH, When I pass two vector cursors to an STL-like subprogram, then inside the subprogram I can look at the vector properties and at elements within the range specified by the two cursors. > (this was discussed in the endless C++/Ada rant a few weeks > ago. IIRC, we had arrays of fixed size in these discussions, or else array subprogram parameters. (Part of the comparison was with std::valarray rather than std::vector, and valarray which offers slicing is special among STL containers, as are Ada arrays among Ada.Containers ;-) -- Georg