title: Is there any way to know what kind of function is in the template in C++?
body: <p>I am trying to rewrite code written in Java to C++, using templates. Here is an example.</p>
  
  <p>Code looks like this:</p>
  
  <pre><code>class IBookUpdatedHandler {
  public:
      virtual ~IBookUpdatedHandler() {}
      virtual void updateBook(int bookIndex)=0;
  };
  
  class IBookFiredHandler {
  public:
      virtual ~IBookUpdatedHandler() {}
      virtual void fireBook(int bookIndex)=0;
  };
  
  
  template &lt;typename T&gt;
  class Dispatcher {
  private:
      list&lt;T&gt; listeners;
      const char* methodName;
  
  public:
      Dispatcher(const char* name) {
          this-&gt;methodName = name;
      }
  
      void add(T listener) {
          listeners.push_back(listener);
      }
  
      void dispatch() {
          // listeners loop
          for(typename list&lt;T&gt;::iterator pos = listeners.begin(); pos != listeners.end(); pos++)
          {
              // i don't know what is in the box .. (list&lt;T&gt;)..
              // call ..
              // listener could have (*pos)-&gt;do_somethig() ?
          }
      }
  };
  
  Dispatcher&lt;IBookUpdatedHandler*&gt; *dispatcher = new Dispatcher&lt;IBookUpdatedHandler*&gt;("updateBook");
  Dispatcher&lt;IBookFiredHandler*&gt; *dispatcher = new Dispatcher&lt;IBookFiredHandler*&gt;("fireBook");
  </code></pre>
  
  <p>I want to call a <code>updateBook</code> or <code>fireBook</code> in the <code>dispatch()</code> function but, In C++, I think there is no way to know what is in the typename.</p>
  
  <p><strong>Is there a C++ equivalent of Java's <code>getMethod</code>?</strong></p>