title: Is there anyway in C++11 to get member pointer type within a template?
body: <p>I know this was not possible in C++03, but I'm hoping there is some new voodoo to allow me to do this. See below:</p>
  
  <pre><code>template &lt;class T&gt;
  struct Binder
  {
      template&lt;typename FT, FT T::*PtrTomember&gt;
      void AddMatch();
  };
  struct TestType
  {
      int i;
  };
  int main(int argc, char** argv)
  {
      Binder&lt;TestType&gt; b;
      b.AddMatch&lt;int,&amp;TestType::i&gt;(); //I have to do this now
      b.AddMatch&lt;&amp;TestType::i&gt;(); //I'd like to be able to do this (i.e. infer field type)
  }
  </code></pre>
  
  <p>Is there any way to do this in C++11? Will decltype help?</p>
  
  <p>** UPDATE: Using Vlad's example I Was thinking something like this would work (caveat: I have not compiled as I am building the compiler with decltype support now)</p>
  
  <pre><code>template &lt;class T&gt;
  struct Binder
  {
      template&lt;typename MP, FT ft = decltype(MP)&gt;
      void AddMatch()
      {
          //static_assert to make sure MP is a member pointer of T
      }
  };
  struct TestType
  {
      int i;
  };
  int main()
  {
      Binder&lt;TestType&gt; b;
      b.AddMatch&lt;&amp;TestType::i&gt;();  
  }
  </code></pre>
  
  <p>Would this work?</p>