title: c++ {*this} inside curly braces
body: <p>The following code compiles fine:</p>
  
  <pre><code>g++ -std=c++11 test.cpp -Wall -Wextra -Wfatal-errors &amp;&amp; ./a.out
  </code></pre>
  
  <p>However, if I remove the curly braces from <code>{*this}</code> and use <code>*this</code> instead, I will face with error:</p>
  
  <blockquote>
    <p>error: use of deleted function ‘Obj::Position::Position(Obj::Position&amp;&amp;)’</p>
  </blockquote>
  
  <p>What is the difference between <code>{*this}</code> and <code>*this</code>?</p>
  
  <pre><code>class Obj
  {
      template&lt;bool&gt; friend class Position;
  
      double data;
  public:
      class Position
      {
          const Obj&amp; ref;
      public:
          inline Position(const Obj&amp; ref): ref(ref){}
          inline Position(Position const &amp;) = delete;
          inline Position(Position &amp;&amp;) = delete;
      };
      inline Obj(){}
      inline Obj(const double &amp;data): data(data){}
      inline auto get_pos() const-&gt; Position{return {*this};} /* &lt;--- here */
      inline auto get_pos()-&gt; Position{return {*this};}
  };
  
  int main()
  {
      return 0;
  }
  </code></pre>