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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,103b407e8b68350b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-24 17:30:51 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed2.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: Richard Riehle Newsgroups: comp.lang.ada Subject: Re: Anybody in US using ADA ? One silly idea.. Date: Fri, 24 Jan 2003 17:40:00 -0800 Organization: AdaWorks Software Engineering Message-ID: <3E31EAF0.6A322860@adaworks.com> References: <1041908422.928308@master.nyc.kbcfp.com> <1041997309.165001@master.nyc.kbcfp.com> <1042086217.253468@master.nyc.kbcfp.com> <1042477504.547640@master.nyc.kbcfp.com> <1042651417.215661@master.nyc.kbcfp.com> <1042743579.1165@master.nyc.kbcfp.com> <1042824191.538184@master.nyc.kbcfp.com> <3E28534F.DD4016C3@adaworks.com> <1042833721.656780@master.nyc.kbcfp.com> Reply-To: richard@adaworks.com NNTP-Posting-Host: 3f.bb.a9.51 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 25 Jan 2003 01:30:50 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:33414 Date: 2003-01-25T01:30:50+00:00 List-Id: Hyman Rosen wrote: > C++ template specialization is different though; it doesn't > (necessarily) involve tagged types at all. Here's a simple > example: > > // General case > template > struct Factorial { enum { Value = N * Factorial::Value } }; > > // Specialization for 0 > template<> > struct Factorial<0> { enum { Value = 1 } }; > > // Use it, as a compile-time constant expression > int array[Factorial<5>::Value]; > > When you ask for Factorial<0>, the compiler uses the special case > you provided, otherwise it uses the general case. This looks a lot like a form of overloading. Combine this with generic subprograms, or generic child library units, and we have a pretty close match in capability. Richard Riehle