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 electronics |
c++ - pointer with typename
Hi. This code doesnt compile with gcc, dmc, icc. But I think it should :) any comments... Mar 22 2007
sevki skrev:Hi. This code doesnt compile with gcc, dmc, icc. But I think it should :) any comments... Mar 23 2007
well, it can, and a good example of it is "curiously recurring template" pattern. go get a c++ book.. Mar 23 2007
sevki skrev:well, it can, and a good example of it is "curiously recurring template" pattern. go get a c++ book.. Mar 23 2007
sevki wrote:well, it can, and a good example of it is "curiously recurring template" pattern. go get a c++ book.. Mar 23 2007
Arjan Knepper skrev:sevki wrote:well, it can, and a good example of it is "curiously recurring template" pattern. go get a c++ book.. Mar 23 2007
sevki wrote:well, it can, and a good example of it is "curiously recurring template" pattern. go get a c++ book.. Mar 24 2007
I want to keep privC "in the scope" of a class: There will be class A : public Base<A> class B : public Base<B> etc. all having the "same" interface, and all of them's private implementation is called privC. so either in A, B, etc. or later I'll define class A::privC, class B::privC, etc.. In the code that I've sent, if one replaces "typename T::privC * priv" with "T * priv" then it's valid and it compiles, BUT STILL "the type used as argument (A) is incomplete at instatiating the template Base class"... also, "the argument type being incomplete" is the core feature of "curiously recurring template pattern", and i know there is no problem with it. I think the problem is with the C++ standard. The code I've sent is, to my opinion, clear and should be compilable. or least it is as compilable as the usual use of the curiously recurring template pattern. thx, Sevki Mar 24 2007
|