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,604e0f87aa06eab6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-26 09:10:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!news.litech.org!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-out.visi.com!petbe.visi.com!uunet!ash.uu.net!spool0902.news.uu.net!not-for-mail Date: Wed, 26 Mar 2003 12:00:47 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4a) Gecko/20030313 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Imitation is the sincerest form of flattery References: <1048524746.273345@master.nyc.kbcfp.com> <1048530794.5794@master.nyc.kbcfp.com> <1048623730.801824@master.nyc.kbcfp.com> <8j838v81tn0t2ft4locfphs6tg6t7e1lvb@4ax.com> <1048691202.136151@master.nyc.kbcfp.com> <1ij38vsm381u560p0rmhenia606ggo9jpv@4ax.com> In-Reply-To: <1ij38vsm381u560p0rmhenia606ggo9jpv@4ax.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1048698047.463797@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: 1048698048 27262 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:35731 Date: 2003-03-26T12:00:47-05:00 List-Id: Dmitry A. Kazakov wrote: > It is no more a normal subroutine taking Element a parameter. Oh, sorry - I thought we were passing the array around. Anyway, in C++ you just need to have a conversion to reference to element type in the proxy class. template struct funky_array { struct index_proxy { funky_array &a; int i; index_proxy(funky_array &a, int i) : a(a), i(i) { } operator Element &() { return a.get_element(i); } }; Element &get_element(int i) { /* find and return the element */ } index_proxy operator[](int i) { return index_proxy(*this, i); } };