title: Implement a "static observer pattern"
body: <p>I have a class with a method template:</p>
  
  <pre><code>struct Subject
  {
    template &lt;typename T&gt;
    void doSomething()
    {
      ..
    }
  };
  </code></pre>
  
  <p>Now whenever <code>doSomething</code> is called (with any <code>T</code>) I would like to have an "Observer" be notified:</p>
  
  <pre><code>  template &lt;typename T&gt;
    void onDoSomething()
    {
      ..
    }
  </code></pre>
  
  <p>It's important that the observer is a method template (class template with contained method would work as well). If it wasn't, I could just implement the common observer pattern.</p>
  
  <p>It would be ok to modify <code>Subject::doSomething()</code>so that it calls a method. However, the class <code>Subject</code> should not "know" the concrete Observer / observer method. </p>
  
  <p>The idea behind this is: I use <code>Subject</code> in two projects. I need (and have) the observer only in one of them.</p>
  
  <p>Is there any way to achieve this?</p>