title: Good way of encapsulating member function pointers for a task manager
body: <p>I would like to store a member function pointer and a related object pointer in a template class <code>task</code>. Then I want to make an array and call these member functions in the <code>scheduler</code> class.</p>
  
  <p>However, if I save such <code>task</code>s in an array, they all need to have the same template type. This obstacle makes saving the object pointer in the task class useless.</p>
  
  <p>Now, I wonder whether there is a smart way to safe an array of such pairs in the related scheduler class. If I use a <code>std::tuple</code>, I cannot iterate at run-time through the container, or at least not in a very readable manner. 
  Is there a solution, where I don't need a template for the scheduler class?</p>
  
  <pre><code>template &lt;class Obj&gt;
  struct task {    
      typedef void (Obj::*task_fn_t)();
      Obj*        obj_ptr;  // object referring
      task_fn_t   function; // member function
  };
  
  template &lt;class Obj&gt;
  class scheduler {
      task &lt;Obj&gt; *_tasks; // problem :(
  };
  </code></pre>