title: How to std::forward( *this )
body: <p>because I want to overload all cv and reference qualifications of a member function, I wrote myself the following macro:</p>
  
  <pre><code>#define DEFINE_FUNCTION(sig , functionality) \
      sig &amp; { functionality; } \
      sig &amp;&amp; { functionality; } \
      sig const &amp; { functionality; } \
      sig const &amp;&amp; { functionality; } \
      sig volatile &amp; { functionality; } \
      sig volatile &amp;&amp; { functionality; } \
      sig const volatile &amp; { functionality; } \
      sig const volatile &amp;&amp; { functionality; }
  </code></pre>
  
  <p>Unfortunately, If I want to return <code>*this</code> in a forwarding manner (that is preserving all reference and cv-qualification of the <code>this</code>-pointer within the return type, it seems, I have to manually write all 8 of those overloads.</p>
  
  <p>Now to my question:
  Is it possible to get the cv and reference qualified type of <code>*this</code> in a universal manner?</p>
  
  <p>I have tried <code>decltype(auto)</code> as return type and</p>
  
  <pre><code>return std::forward&lt;decltype(*this)&gt;(*this);
  </code></pre>
  
  <p>but apparently, the resulting expression always resolves to an lvalue reference, even in case of a <code>&amp;&amp;</code>-qualified function.</p>
  
  <p>Can you help me?</p>