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,a3736685ef876ab2 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!i29g2000prf.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: OO Style with Ada Containers Date: Tue, 20 Nov 2007 13:13:49 -0800 (PST) Organization: http://groups.google.com Message-ID: <400347d7-aa93-4175-a3dc-e415ad0d9ca3@i29g2000prf.googlegroups.com> References: <1195082906.420079.195000@d55g2000hsg.googlegroups.com> <1s27rv0gt4ujj$.3e2k326rp54d.dlg@40tude.net> <60e46dc9-d8ca-4f47-9e8a-f90a7d45e752@w28g2000hsf.googlegroups.com> <0319d921-4457-4b47-87f2-3f310aaa3d93@o6g2000hsd.googlegroups.com> <5076f153-d879-43dd-b2c8-ad61eeea241d@d61g2000hsa.googlegroups.com> <4182086a-2968-4c42-b08a-1a30b05fcf63@c29g2000hsa.googlegroups.com> NNTP-Posting-Host: 85.3.78.212 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1195593229 15648 127.0.0.1 (20 Nov 2007 21:13:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 20 Nov 2007 21:13:49 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i29g2000prf.googlegroups.com; posting-host=85.3.78.212; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9,gzip(gfe),gzip(gfe) Content-Disposition: inline Xref: g2news1.google.com comp.lang.ada:18539 Date: 2007-11-20T13:13:49-08:00 List-Id: On 20 Lis, 18:00, Matthew Heaney wrote: > > On 19 Lis, 23:16, Matthew Heaney wrote: > > > 1. > > The most important part of STL is the notion of range-based iteration. > > Every single algorithm that iterates over something gets a pair of > > iterators denoting the range to be visited. > > > sort(v.begin(), v.end()); > > But there's nothing that precludes that in Ada: [...] Right, but it's not there (in AARM). This is probably where we actually disagree. When you say that something is similar to STL, then I expect to *find* STL-like concept and solutions around it, not that I *can* have them if I code them myself. I really appreciate the examples you gave, I have learned something from them. Still, the thing that bothers me is that I have not seen such examples in neither "the" Ada book, nor in AARM itself (and not on this group during the last two years). This is what builds the spirit of some particular solution. I see that you can use Ada to achieve arbitrary effect, but your examples are the first I seen written like this (you might still argue that I haven't seen enough). I assume this is because nobody actually uses Ada.Containers like this. If this is true (and based on "the" Ada book, AARM and this group, this statement is justified), then from my perspective the STL-like coding is not part of the spirit and culture of Ada.Containers. Similarly, I might say that I can have algorithms that work on whole containers in C++: template void sort(Container & c) { sort(c.begin(), c.end()); } but in practice nobody writes like that. It is definitely possible, but not part of the culture. > > Iterator to the vector is a random access iterator, because vector > > itself is inherently random-accessible. > > This is why I was able to do > > the above arithmetics to initialize the iterator to the middle of the > > vector. > > As you can in Ada. You cannot do arithmetics with cursors. They don't have appropriate operators and the examples you shown work with indices, not with cursors. Cursors themselves can be only incremented and decremented. In this regard Ada's cursors are closer to Java than to STL. In any case, your examples are a good motivation for more learning. Thank you for your patience. :-) -- Maciej Sobczak * www.msobczak.com * www.inspirel.com