Get template function type
c++, c++11, function, templates, types
Solution
You want to use explicit specialization of your function template:
template<class T> T* function() {
};
template<> int* function<int>() {
// your int* function code here
};
template<> char* function<char>() {
// your char* function code here
};
Problem
I'm new in using templates in C++, I want to do different things depending on type used between `<` and `>`, so `function<int>()` and `function<char>()` won't do the same things. How can I achieve this? ``` template<typename T> T* function() { if(/*T is int*/) { //... } if(/*T is char*/) { //... } return 0; } ```