title: Write the type of a pointer to member data from other template types
body: <p>I have a function that extracts pointer to member type from other types, and this works:</p>
  
  <pre><code>template&lt;class T2, class Array,
      class Element = typename std::decay_t&lt;Array&gt;::element,
      class PointerToMemberType = T2 Element::*
  &gt;
  v f(Array&amp;&amp; a, PointerToMemberType pm);
  </code></pre>
  
  <p>However I cannot find the way to write <code>PointerToMemberType = ???</code>, without first definining <code>Element</code>, which should be able to be omitted. </p>
  
  <p><strong>How can I write <code>PointerToMemberType</code> directly without using the auxiliary <code>Element</code>?</strong></p>
  
  <p>I tried plain substitution but it doesn't work:</p>
  
  <pre><code>template&lt;
      class T2, class Array, 
      class PointerToMemberType = T2 typename std::decay_t&lt;Array&gt;::element::*
  &gt;
  void f(Array&amp;&amp;, PointerToMemberType pm);
  // error: expected identifier before ‘*’ token
    677 |  class PointerToMemberType = T2 typename std::decay_t&lt;Array&gt;::element::* 
                                                                                 ^
  </code></pre>
  
  <p>I also tried adding <code>typename</code> and parenthesis in several places.</p>
  
  <p>Note that <code>PointerToMemberType</code> is not used for deduction at the moment, although I would try to use it in the future.</p>
  
  <p><strong>In some places it recommends using <code>std::invoke</code> so one doesn't need to deal with pointers-to-data-members, How would that fit or simplify something here?</strong></p>