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++ - template class typeid(&).name() has an extra space
This seemed so minor, but you never know: if you do this string A = typeid(*this).name(); inside a template, you will get an extra space after the typename.. #include <iostream> #include <typeinfo.h> struct Root { }; template<typename T> struct Test { Test() { cout << typeid(*this).name() << endl; } }; void main() { Test<Root> t; } // output is: Test<Root > I verified that it is a space. Richard Dec 04 2002
In article <asln3j$5tb$1 digitaldaemon.com>, Richard (fractal clark.net) says...This seemed so minor, but you never know: if you do this string A = typeid(*this).name(); inside a template, you will get an extra space after the typename.. #include <iostream> #include <typeinfo.h> struct Root { }; template<typename T> struct Test { Test() { cout << typeid(*this).name() << endl; } }; void main() { Test<Root> t; } // output is: Test<Root > I verified that it is a space. Dec 04 2002
|