From -8176313486829477338 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,ede379f5dbbc1549 X-Google-Attributes: gidf78e5,public From: Igor Boukanov Subject: Re: Suggestion: "typeof" keyword Date: 1999/08/16 Message-ID: <37B8157A.ACD52BE0@fi.uib.no>#1/1 X-Deja-AN: 513421656 X-NNTP-Posting-Host: 193.216.30.4 Content-Transfer-Encoding: 7bit Approved: stephen.clamage@sun.com (comp.std.c++) References: <7nt3vl$1oe$1@nnrp1.deja.com> <7oh7o8$t3f$1@nnrp1.deja.com> <7ol6hi$ej9$2@news.BelWue.DE> <120819991357412479%lisa_lippincott@advisories.com> X-Accept-Language: en,ru X-UID: 0000000001 X-Status: $$$T Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@tele2.no X-Trace: juliett.dax.net 934811029 193.216.30.4 (Mon, 16 Aug 1999 15:43:49 MET DST) Organization: Well Service Technology Mime-Version: 1.0 NNTP-Posting-Date: Mon, 16 Aug 1999 15:43:49 MET DST Newsgroups: comp.std.c++ Originator: clamage@taumet Hyman Rosen wrote: > > You could use a potentially standard auxiliary class template: > > template < typename T > struct object { static T &o; }; > > template < typename A, typename B, typename C > > typeof(object::o * object::o + object::o) > MultiplyAdd(const A &a, const B &b, const C &c) > { > return a * b + c; > } > > g++ 2.95, which implements typeof, gets an internal compiler error on this. And g++ 2.95 also gets killed by template typeof( (*(const A*)0) * (*(const B*)0) + (*(const C*)0) ) MultiplyAdd(const A &a, const B &b, const C &c) { return a * b + c; } Regards, Igor -- Igor Boukanov Company: Well Service Technology AS Work: +47 5552 5075 Fax: +47 5552 5051 Web: http://www.wst.no/ Mobil: +47 916 28 390 [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]