
How to use result_of
Hi everybody,
I was wondering if someone could help me understand C++ TR1 result_of better.
It says in the TR1 spec the following:
"Given an rvalue f of type F and values t1, t2, ..., tN of types T1, T2, ..., TN, respectively, the type member is the result type of the expression f(t1, t2, ...,tN). The values ti are lvalues when the corresponding type Ti is a reference type, and rvalues otherwise."
So, I'm a bit confused. Suppose I have a function as follows:
Code:
bool b1(int a) {
return (a < 10 ? true : false);
}
and I want to pass result_of a function pointer to this and get back the type. How would I do this?
Also, how do I set the values for the expression f(t1, t2, ...,tN), e.g. b1(2), and get back the type when I have to pass in something like result_of<F(X, Y)>::type?
Hope that made sense.
Thanks a lot.
Tony