title: const_cast 'this' in const method to assign 'this' to outer variable?
body: <p>Have a look at the following code:</p>
  
  <pre><code>struct Foo;
  
  Foo* bar;
  
  struct Foo {
      void func() const {
          bar = this;
      }
  }
  
  int main() {
      Foo().func();
  }        
  </code></pre>
  
  <p>This does not work as <code>bar</code> won't accept a <code>const Foo*</code>. To get around this, <code>const_cast</code> could be used:</p>
  
  <pre><code>struct Foo {
      void func() const {
          bar = const_cast&lt;Foo*&gt;(this);
      }
  }
  </code></pre>
  
  <p>Is this safe? I'm very cautious when it comes to using <code>const_cast</code>, but in this case it seems legit to me.</p>