Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - macro (bis)
i have the class: template <class T, int DIM> class npoint { public: . . T& operator[](const int i) { return coord[i]; } . . public: T coord[DIM]; }; #define .x .coord[0] #define .y .coord[1] #define .z .coord[2] does not compile: "identifier expected" because of .x, .y, .z #defines my questions: - is it suposed to compile ?, if not, in few word why ? (just for my general culture) - do i missed something, is there a way to make it compile ? thanks roland PS: i know those #define are a little limit dangerous. made for compatibility with existing code. and it is better than #define x coord[0] isn't it ? Apr 06 2002
|