Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Generic typeid function in C++

#include <iostream>
#include <typeinfo>

// declaration of template
template <typename T>
void print_typeof (T const&);

// implementation/definition of template
template <typename T>
void print_typeof (T const& x)
{
    std::cout << typeid(x).name() << std::endl;
}


// using of template

int main()
{
    double ice = 3.0;
    print_typeof(ice);  // call function template for type double
}