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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,583275b6950bf4e6 X-Google-Attributes: gid103376,public X-Google-Thread: fdb77,5f529c91be2ac930 X-Google-Attributes: gidfdb77,public X-Google-Thread: 11232c,59ec73856b699922 X-Google-Attributes: gid11232c,public X-Google-Thread: f43e6,899fc98b2883af4a X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,59ec73856b699922 X-Google-Attributes: gid1108a1,public X-Google-ArrivalTime: 2003-05-20 06:18:07 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-out.visi.com!petbe.visi.com!uunet!ash.uu.net!spool0900.news.uu.net!not-for-mail Date: Tue, 20 May 2003 09:18:05 -0400 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030506 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.java.advocacy,comp.object,comp.lang.ada,misc.misc,comp.software-eng Subject: Re: Quality systems (Was: Using Ada for device drivers? (Was: the Ada mandate, and why it collapsed and died)) References: <9fa75d42.0304230424.10612b1a@posting.google.com> <9fa75d42.0305091549.48b9c5d9@posting.google.com> <7507f79d.0305121629.5b8b7369@posting.google.com> <9fa75d42.0305130543.60381450@posting.google.com> <254c16a.0305140549.3a87281b@posting.google.com> <9fa75d42.0305141747.5680c577@posting.google.com> <254c16a.0305160425.3bb89749@posting.google.com> <1053091306.979352@master.nyc.kbcfp.com> <7vaddj8k3d.fsf@vlinux.voxelvision.no> <7v65o78gtv.fsf@vlinux.voxelvision.no> <5ddnp-a63.ln1@lexi2.athghost7038suus.net> In-Reply-To: <5ddnp-a63.ln1@lexi2.athghost7038suus.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1053436685.260636@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1053436686 2168 204.253.250.10 Xref: archiver1.google.com comp.lang.java.advocacy:64257 comp.object:63748 comp.lang.ada:37561 misc.misc:14311 comp.software-eng:19319 Date: 2003-05-20T09:18:05-04:00 List-Id: The Ghost In The Machine wrote: > A for_each() construct in C++/STL is highly preferable anyway. Only if you include some third-party stuff, like Boost's Lambda Library. The problem with for_each and its ilk is that you must supply a functor, and without this library or something similar, that functor has to be defined out of line, distant from the point where it is used. Using LL, it's much simpler, and then for_each is OK. > for_each(a,a+sizeof(a)/sizeof(a[0]),f); As I said in the other post, it's much better to define begin and end function templates for arrays. Then do for_each(begin(a), end(a), f); You could also define begin and end for the other container types and use uniform syntax: template typename T::iterator begin(std::vector &v) { return v.begin(); } template typename T::const_iterator begin(std::vector const &v) { return v.begin(); }