From -8374341227503828639 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,379892835b2ce20d X-Google-Attributes: gidf78e5,public From: ncm@nospam.cantrip.org (Nathan Myers) Subject: Re: Inheritance and template with g++ and eg++ Date: 1999/01/19 Message-ID: <780sh8$con$1@shell7.ba.best.com>#1/1 X-Deja-AN: 434448182 Approved: stephen.clamage@sun.com (comp.std.c++) References: <77vqab$5c7$1@news-sop.inria.fr> Organization: http://www.cantrip.org/ X-UID: 0000000001 X-Status: $$$T Newsgroups: comp.std.c++ Originator: clamage@taumet Helene Prieto wrote: > >I have some problems with inheritance and template... >Here is my code : > > #include > #define VIEW(a,B) (*static_cast(&a)) > #define $VIEW(T,C) C > #define $CATEGORY(S) template struct S > > $CATEGORY(S) { }; > struct VOID {}; > > template void Prt($VIEW(T,S) & p) { VIEW(p,T).print(); } This is bad code. Expanding the macros (why use them, if they cause confusion?), we have template void Prt(S & p) { T

.print(); } "T

" is meaningless. (Maybe you should go down the hall and visit Gabriel Dos Reis, also at INRIA.) I haven't looked at the rest of the code posted, there may be other problems in it. -- Nathan Myers ncm@nospam.cantrip.org http://www.cantrip.org/ [ 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 ]