title: C++ Remove element from std::vector containing closures with variadic templates
body: <p>I have a class based on the code shown here:
  <a href="http://geekswithblogs.net/raccoon_tim/archive/2011/09/28/lambdas-and-events-in-c.aspx" rel="nofollow">http://geekswithblogs.net/raccoon_tim/archive/2011/09/28/lambdas-and-events-in-c.aspx</a></p>
  
  <p>The difference is that I am using <strong>variadic templates</strong>.</p>
  
  <p>It works well but I can not remove a callback from the vector because I am not able to find it.</p>
  
  <p>Either I am getting an error or I am getting some weird values which I can not compare to find the element.</p>
  
  <p>The code which won't work is:</p>
  
  <pre><code>for (auto i = this-&gt;handler.begin(); i != this-&gt;handler.end(); i++) {
      if ((*i).target&lt;void(Args...)&gt;() == f.target&lt;void(Args...)&gt;()) {
          this-&gt;handler.erase(i);
          break;
      }
  }
  </code></pre>
  
  <p>I googled a lot but I was not able to find anything working for this case. For example std::find does not work in my case.</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Silberling</p>
  
  <p>EDIT:
  As far as I found out is the major problem that std::function does not support == and != for reasons. Is there a way to get around this? Isn't there a method to identify the lambdas so I cam remove it again? I mean, at least it has a location in memory.
  .target_type() is another approach which I am trying to find out but it thows some "attempting to reference a deleted function"</p>