<p>I'm trying to figure out how to write this function:</p>

<pre><code>template &lt;typename Bound&gt;
Bound::result_type callFromAnyList(Bound b, list&lt;any&gt; p)
{
}
</code></pre>

<p>Then, if I had some function:</p>

<pre><code>double myFunc(string s, int i)
{
    return -3.0;
}
</code></pre>

<p>I could call it by doing something like this:</p>

<pre><code>list&lt;any&gt; p;
p.push_back((string)"Hello");
p.push_back(7);
double result = callFromAnyList(bind(myFunc, _1, _2), p);
</code></pre>

<p>Is it possible to write something like my <code>callFromAnyList</code> function?  Can you inspect the result type and the parameter types from the type returned from <code>bind</code>?  And then call <code>any_cast&lt;P1&gt;(*p.begin())</code>, etc?  I've tried to understand the bind code, but it's a little hard to follow, and it doesn't appear as though they wrote it with inspection in mind.</p>

As you updated your concerns in the comment sections, here the answer. Just getting the return type of a function is possible:
```
```
template<typename>
struct return_of;

template<typename R>
struct return_of<R(*)()> {
    typedef R type;
};

template<typename R, typename P1>
struct return_of<R(*)(P1)> {
    typedef R type;
    typedef P1 parameter_1;
};

void foo(int);

template<typename Func>
typename return_of<Func>::parameter_1 bar(Func f) {
    return 42;
}

// call: bar(foo);
```
```
I guess you see what this comes down to :) You can use boost function types which already has solved it:
http://www.boost.org/doc/libs/1_37_0/libs/function_types/doc/html/index.html