RE:RE: [Dev-C++] typedef for a class
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Pierre R. <pie...@wa...> - 2003-03-22 09:50:09
|
Jaap, Thank you for your answer. This point escaped me. I found some very = interresting "workarounds",=20 www.gotw.ca/gotw/079.htm http://msdn.microsoft.com/library/en-us/dndeepc/html/deep08032000.asp=20 but they need to modyfy the code in each place where smart_ptr appears. As I don't want to search all the "smart_ptr" occurrences, I will stay = with the "#define" solution.=20 Regards Pierre Raoul=20 > -----Original Message----- > From: Jaap de Wolff [mailto:wo...@Ne...] > Sent: Friday, March 21, 2003 3:28 PM > To: 'Pierre Raoul' > Subject: RE: [Dev-C++] typedef for a class >=20 >=20 > What you do wrong is that you try to make a template to a type. > The CPtr template is a template, and n o t a class, so you can't > typedef a new type to it. > You can use a define, while define is a preprocessor trick, not a = compiler > trick. >=20 > > -----Original Message----- > > From: Pierre Raoul [mailto:pie...@wa...] > > Sent: Friday, March 21, 2003 11:37 AM > > To: Sourceforge. Net Dev-Cpp-Users@Lists. > > Subject: [Dev-C++] typedef for a class > >=20 > >=20 > > Hello, > >=20 > > I'm using Dev-Cpp 4.9.7.0, GCC 3.2, MingW 2.0.0.3, Msys=20 > > 1.0.7, under Windows Me. > >=20 > > I'd like to use a new type of smart pointer but without=20 > > changing all the reference in the code. I try the code below: > >=20 > > - in a header file cptr.h, I have: > >=20 > > template < class T > =20 > > class CPtr // Counted Pointer =20 > > { =20 > > [...] > > }; // CPtr=20 > >=20 > > - and in an other file, I put: > >=20 > > [...] > > #include <string> > > #include "include/cptr.h" // smart pointer CPtr > >=20 > > [...] > > using std::string ; > >=20 > > typedef CPtr smart_ptr ; > > //#define smart_ptr CPtr > > typedef smart_ptr< string > StringPtr ; > >=20 > > [...] > >=20 > > The compiler gives a "syntax error before ;" for the line=20 > > "define CPtr smart_ptr;". > > Everything is OK if I use "#define CPtr smart_ptr".=20 > >=20 > > I don't see where is the point with this error? Any idea? > >=20 > > Thanks > >=20 > > Pierre Raoul > >=20 > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > >=20 |