title: Transform vectory by non-static member function
body: <p>Consider this template function:</p>
  
  <pre><code>template&lt;class T, class F&gt; inline
  auto transform(const vector&lt;T&gt;&amp; l, F func) -&gt; vector&lt;decltype(func(T{}))&gt;
  {
      vector&lt;decltype(func(T{}))&gt; out(l.size());
      std::transform(l.begin(), l.end(), out.begin(), func);
      return out;
  }
  </code></pre>
  
  <p>This function can be called as</p>
  
  <pre><code>auto out = transform(intputVector, functor)
  </code></pre>
  
  <p>functor has to be either static member fuction or a global function. </p>
  
  <p>Is there a way to modify the above code to work on non-static member functions as well?</p>
  
  <pre><code>struct Test {
  
      Test() {
  
          vector&lt;int&gt; vx = { 1, 2, 3 };
          auto vy1 = transform(vx, staticMemberFunc); // is fine
          auto vy2 = transform(vx, memberFunc); // does not compile
  
      }
  
      flt memberFunc(int x) {
          return 2 * x;
      }
  
      static flt staticMemberFunc(int x) {
          return 2 * x;
      }
  };
  </code></pre>