Pedro Lamarão wrote:
On 17 fev, 12:13, "C.W.Holeman II" <cwhii_google_s...@yahoo.com>
wrote:
Pedro Lamarão wrote:
On 16 fev, 20:27, "C.W.Holeman II" <cwhii_google_s...@yahoo.com>
wrote:
Is there a reference that decodes the output from typeid().name()?
The C++ Standard does not specify the value of that expression.
It could very well be the null string in a conforming specification.
Which is the reason I posted to gnu.g++.help not c++.
Good point.
GCC implements the Itanium C++ ABI, specified here:
http://www.codesourcery.com/public/cxx-abi/abi.html
You will see that, contrary to my expectation, this specification does
in fact guarantee some form to that expression.
Search for the demangler API.
Thanks.
#include <iostream>
#include <typeinfo>
#include <cxxabi.h>
class X {
public:
template<typename T> void operator[](T const&){
size_t len;
int s;
char* p=abi::__cxa_demangle(typeid(T).name(), 0, &len, &s);
std::cout << typeid(T).name() << ": " << p << std::endl;
}
};
int main(){
X x;
x["Hello, world!"];
x[1];
x[-1.234];
x[x];
}
--
C.W.Holeman II cwh...@julian5locals.com-5s http://JulianLocals.com/cwhii
To only a fraction of the human race does God give the privilege of
earning one's bread doing what one would have gladly pursued free, for
passion. I am very thankful. The Mythical Man-Month Epilogue/F.P.Brooks
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus