title: Using template type as argument to std::invoke
body: <p>Consider this code:</p>
  <pre class="lang-cpp prettyprint-override"><code>using namespace std;
  
  struct FS
  {
      void print() { cout &lt;&lt; &quot;p\n&quot;; }
      int s;
  };
  
  template &lt;typename T, typename F&gt;
  void myInvoke(T&amp; t, F f)
  {
      invoke(f, t) = 10;
  }
  
  int main(int, char**) 
  {
      FS fs;
  
      myInvoke(fs, &amp;FS::s);
  
      cout &lt;&lt; fs.s &lt;&lt; &quot;\n&quot;;
  }
  
  </code></pre>
  <p>Is there anyway to avoid the runtime cost of passing the <strong>class member pointer</strong> to <strong>myInvoke</strong>?</p>
  <p>I can of course do:</p>
  <pre class="lang-cpp prettyprint-override"><code>template &lt;typename T&gt;
  void myInvoke(T&amp; t)
  {
      invoke(&amp;T::s, t) = 10;
  }
  
  // then call with
  myInvoke(fs);
  </code></pre>
  <p>What I'd like to do:</p>
  <pre class="lang-cpp prettyprint-override"><code>template &lt;typename T, typename P, P FS::* f&gt;
  void myInvoke(T&amp; t)
  {
      invoke(f, t) = 30;
  }
  
  // call with:
  myInvoke&lt;FS, int ,&amp;FS::s&gt;(fs);
  </code></pre>
  <p>But without the <strong>typename P</strong>. Is there any way to make the call more concise so it can be called with:</p>
  <pre class="lang-cpp prettyprint-override"><code>myInvoke&lt;FS, &amp;FS::s&gt;(fs);
  </code></pre>
  <p>I know this is a bit arcane, but it'd be really nice to be as concise as possible. Especially when you have widely used library functions.</p>
  <p>EDIT:
  Link to sandbox above code: <a href="https://godbolt.org/z/z4cGdPd3r" rel="nofollow noreferrer">https://godbolt.org/z/z4cGdPd3r</a></p>