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,55f6e230b02eff2f X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.buerger.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Containers - nontrivial element access Date: Mon, 1 Oct 2007 21:34:49 -0500 Organization: Jacob's private Usenet server Message-ID: References: <1191275759.184463.238350@n39g2000hsh.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1191292317 11842 69.95.181.76 (2 Oct 2007 02:31:57 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 2 Oct 2007 02:31:57 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896 Xref: g2news2.google.com comp.lang.ada:2243 Date: 2007-10-01T21:34:49-05:00 List-Id: "Maciej Sobczak" wrote in message news:1191275759.184463.238350@n39g2000hsh.googlegroups.com... ... > I would like to swap salaries of two guys which I can refer with the > index/iterator/cursor/etc. The reference method is not really > important - what is important is the problem of modifying more than > one element in the container. Why don't you just use the Swap operation of the containers? One would presume that it is implemented as efficiently as possible. (Surely if you are using the indefinite version of the containers, it would just be a pointer swap; might be a copy with the definite version of vectors, but that couldn't be avoided as the object order is significant in that sort of implementation.) That surely seems better than using explicit pointers; in most cases, worries about efficiency are premature (and when they're not, you probably shouldn't be using the predefined containers anyway). Randy.