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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f2690a5e963b61b6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail From: "Dmitriy Anisimkov" Newsgroups: comp.lang.ada Subject: Re: GCC 4.0 Ada.Containers Cursor danger. Date: 7 Jul 2005 05:29:43 -0700 Organization: http://groups.google.com Message-ID: <1120739383.801736.224270@o13g2000cwo.googlegroups.com> References: <1120474891.635131.216700@g44g2000cwa.googlegroups.com> <1120575076.876798.108220@g44g2000cwa.googlegroups.com> <1120583470.429264.325450@g43g2000cwa.googlegroups.com> <1120639461.224146.235430@g44g2000cwa.googlegroups.com> <1120642489.101644.74190@o13g2000cwo.googlegroups.com> <1120643138.031761.212450@g43g2000cwa.googlegroups.com> <42cbb52c$0$10807$9b4e6d93@newsread4.arcor-online.net> <1120666922.733581.179180@g47g2000cwa.googlegroups.com> <42cc1f0f$0$10808$9b4e6d93@newsread4.arcor-online.net> NNTP-Posting-Host: 80.89.131.48 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1120739389 31169 127.0.0.1 (7 Jul 2005 12:29:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 7 Jul 2005 12:29:49 +0000 (UTC) In-Reply-To: <42cc1f0f$0$10808$9b4e6d93@newsread4.arcor-online.net> User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: o13g2000cwo.googlegroups.com; posting-host=80.89.131.48; posting-account=t4CEmgwAAAA8dL2naG2k3iz_rN__dZy3 Xref: g2news1.google.com comp.lang.ada:11926 Date: 2005-07-07T05:29:43-07:00 List-Id: << > Maybe i do not good understand the meaning of "versatility", but I was > able fast to do whatever i want whithout cursors under ADT. You keep saying, "Mine was fast!" and you don't tell us how fast compared to what. How can repeated hashing be as fast as direct access via a cursor?>> I do not think that "repeated hashing be as fast as direct access via a cursor". If I need direct access to elements, I put dynamically allocated object (maybe smart pointer) into container, and keep access where i need. I think it is more honestly than to keep cursors. So I take responsibility for deallocation. And library does not have to check for invalid cursors. <> Strange question. I do not know answer. I did not propose linear search. <> If user need direct access, he has to create this access himself. <> In the safe containers loop should be inside generic procedure, and without cursors. generic procedure Process (Key : Key_Type; Value : Value_Type; Stop : out Boolean); procedure Generic_Iteration (Container : Container_Type); -- Process all elements untill Stop. <> The container is not thread safe I see, so, the nobody would modify it untill we are working on it. It would be better to put elements into container after the loop. If we really need to put it there before loop, I would put access into containers and modify content via access.