Scala: How do I dynamically instantiate an object and invoke a method using reflection?

There is an easier way to invoke method reflectively without resorting to calling Java reflection methods: use Structural Typing. Just cast the object reference to a Structural Type which has the necessary method signature then call the method: no reflection necessary (of course, Scala is doing reflection underneath but we don’t need to do it). … Read more

Unmangling the result of std::type_info::name

Given the attention this question / answer receives, and the valuable feedback from GManNickG, I have cleaned up the code a little bit. Two versions are given: one with C++11 features and another one with only C++98 features. In file type.hpp #ifndef TYPE_HPP #define TYPE_HPP #include <string> #include <typeinfo> std::string demangle(const char* name); template <class … Read more