double f(const int& i) { return 1.5 * i; }
template<
typename _out,
typename _in,
_out (*__f)(const _in&)>
class X {}; // template <... __f> class X {};
int main()
{
X<double, int, f> x; // X<f> x;
}
How can I simplify this code? I want to write code as the one in the comments. C++11 result_of and decltype seems to help but I not smart enough to write correct code to deduce the input and output types of the function f inside of the class. Can you help me see the light? Thanks