title: passing a member function to std::signal
body: <p>I have class A, that has a shutdown method that closes all the sockets that has opened.</p>
  
  <p>I want to have a signal handler to close all the sockets that have been opened at runtime if the user terminates the program. I need something like the code below, but of course, it does not work this way.
  I tried something like this,</p>
  
  <pre><code>#include &lt;csignal&gt;
  
  struct A
  {
      void shutdown() {}
      int a = 0;
  };
  
  int main()
  {
      A a;
      auto t = [&amp;]()-&gt;void {a.shutdown();};
      std::signal(SIGINT, t);
  }
  </code></pre>