Casting a tr1::function to a void*
<p>I have the following tr1::function prototype that I am trying to cast to a void*:</p>

<pre><code>typedef std::tr1::function&lt;cv::Mat (const cv::Mat,const void*)&gt; preprocessingFunc;
</code></pre>

<p>In this function I am storing it in a vector that contains structures denoting the type of function and the pointer to the function:</p>

<pre><code>void ImageGraph::addNode(preprocessingFunc func)
{
    NodeFunction nodeFunction = { typeid(func), (void*)func };
    //nodes.push_back(nodeFunction);
}
</code></pre>

<p>The error I get:</p>

<blockquote>
  <p>ImagePipeline.cpp: In member function ‘void IP::ImageGraph::addNode(IP::preprocessingFunc)’:
  ImagePipeline.cpp:32: error: invalid cast from type ‘IP::preprocessingFunc’ to type ‘void*’
  /usr/include/c++/4.2.1/typeinfo:135: error: ‘std::type_info::type_info(const std::type_info&amp;)’ is private
  ImagePipeline.cpp:32: error: within this context</p>
</blockquote>

<p>Is it possible to cast this function type to a pointer (void*)? If not, is there a better way to achieve what I am doing?</p>

<p>For clarity I am storing function pointers to call at later dates, and their are currently 3 types of function pointers, however I would like to store them all in the same vector.</p>
